Apache
Understanding ProxyPassReverse
The ProxyPassReverse
directive is slightly confusing as to what exactly it does. It is often coupled with a standard ProxyPass
directive, which we expect to do all of the proxying work necessary. But the ProxyPassReverse
directive manages redirected URLs on the proxied server. For example, requests to the front facing domain [py.smgr.io](http://lab.smgr.io)
are reverse proxied by the web server to the local Jupyter server [localhost:5000](http://localhost:5000)
on the cloud server. But now, if the local server redirects to a particular Notebook URL (which happens often), the web server will serve the URL [localhost:5000/newurl/](http://localhost:5000/newurl/)
back to the client (naively). This of course will not work for a client accessing this public domain and will be redirected on their own machine to port 5000. So ProxyPassReverse
directive is responsible for remapping these redirect requests so that they match the original public domain doing the reverse proxying. That is, the redirect will be sent to py.sngr.io/newurl/
.