It all comes down to the idea that the URL is meant to indicate the location of the resource, and the URI, as a part of that, is meant to identify which specific resource you want. The hostname part of the URL, by convention, marks which website you want; the URI, in its entirety, marks which webpage.
When you reverse proxy a whole website into its own subfolder, you’re flipping the script a little. You’re using the first part of the URI as something of an extension of the hostname, to tell the web server which website you want. Now, the web server is quite capable of handling this - Caddy is built to be flexible and handle requests differently based on the URI.
Caddy can even omit that URI prefix the client used to tell Caddy which website it wants, so that the website you proxied to via /reboot
doesn’t receive a request for “/reboot/index.html” and go “What? I don’t have a /reboot folder…” But in a vacuum, the website thinks it’s got the whole URI, because that’s the assumption the system is based on.
I’m writing a small web app in golang now, and one of the features I’m working on is the ability to set a URL base. You would be surprised at just how many points in the logic you have to thread through this idea of a possible, arbitrary URI prefix. Every time my app issues a redirect, puts an <a href=
tag in, it needs to check if the user set a URL base and prepend it to whatever link it’s about to spit out. If I didn’t do that, every link in my app wouldn’t have whatever subfolder I wanted to reverse proxy it into, and all those requests would go to Caddy, and Caddy would have no idea what to do with them. It’s got no way to differentiate which app those requests should go to, except for the URI.
So unless I write my app to accommodate that URI prefix/URL base, right at the core of the program, when you click “home” in my app it’s going to send you to /
. And Caddy will happily render the index.html
of your root
directive, because that’s what you told it to do.
TL;DR: The webui dev never even considered the likelihood that you will reverse proxy it into a subfolder, so they never put the effort in to make it possible.