Reverse proxy with mod_proxy, keep request source URL

I set up a reverse proxy using mod_proxy (Apache2) listening on 127.0.0.1:80, which proxies the whole request to 127.0.0.1:8080

So, I configured mod_proxy as:

ProxyPreserveHost On
ProxyRequests Off
ProxyPass /foo http://127.0.0.1:8080
ProxyPassReverse /foo http://127.0.0.1:8080

When I request http://127.0.0.1/foo/bar, the application listening on 127.0.0.1:8080 gets the following request URL from mod_proxy:

http://127.0.0.1/bar

Instead, I want to save the original request and get:

http://127.0.0.1/foo/bar

How can i do this?

+3
source share
1 answer

Fixed:

ProxyPreserveHost On
ProxyRequests Off
ProxyPass /foo http://127.0.0.1:8080/foo
ProxyPassReverse /foo http://127.0.0.1:8080/foo
+4
source

All Articles