mod_proxy and trailing slashes?
Read carefully the section on ProxyPass in Apache httpd documentation (http://httpd.apache.org/docs/current/mod/mod_proxy.html). You can likely get around this behavior by explicitly specifying the trailing / for both arguments of the ProxyPass directive
ProxyPass /my-web-app/ http://blah.example.com/some-other-path/
Related videos on Youtube
![Admin](/assets/logo_square_200-5d0d61d6853298bd2a4fe063103715b4daf2819fc21225efa21dfb93e61952ea.png)
Admin
Updated on September 18, 2022Comments
-
Admin almost 2 years
We use httpd and mod_proxy as a reverse proxy in front of our different web servers.
We have our
www
subdomain pointed to the reverse proxy, and mod_proxy directs requests from there.I haven't been able to come up with a concise way of saying this, so I'll just show:
If we have a web site at http://blah.example.com/my-web-app, we'll usually add a line like this to the reverse proxy:
ProxyPass /my-web-app http://blah.example.com/my-web-app
so that a user can go to
http://www.example.com/my-web-app
. When the path component of the request (/my-web-app
in this case) is the same on both the reverse proxy, and the web server, the trailing slash will get added automatically, just like if someone went straight tohttp://blah.example.com/my-web-app
.However, if the path components are different, e.g.:
ProxyPass /my-web-app http://blah.example.com/some-other-path
then the trailing slash does not get added.
Is this behavior normal? Is there some configuration that could take care of this?