I have a domain on my site, review.jvt.me, which is currently being hosted by Nginx, and the config can be found at the bottom of the post. The specifics are not important, but it enables me to have the following:
if I put a folder feature-review into some pre-defined path, I can access it on feature-review.review.jvt.me
these paths are not known up-front, as they are dynamically deployed
I was wondering if there was some way to achieve the same functionality in Caddy?
The next release of Caddy is getting {labelN} placeholders, like {label1} to mean whatever value is in the first label of *.example.com. That should make rewriting it in Caddy pretty trivial, no?
You’re actually right about that - it does, in fact, only work on the URI… technically speaking.
The trick works because when figuring out what file to serve to the client, web servers take the webroot - for the sake of example, lets say /var/www/html - and add the URI, lets say /foo/bar.jpg - to get a final result of /var/www/html/foo/bar.jpg off the host’s disk.