Mobile app version of vmapp.org
Login or Join
Fox8124981

: ProxyPassReverse doesn't keep me on the proxy URL when I click around I have the following virtual host on my personal web server which runs on my NAS.I have dynDNS setup to redirect both

@Fox8124981

Posted in: #Apache2 #Proxy #ReverseProxy

I have the following virtual host on my personal web server which runs on my NAS.I have dynDNS setup to redirect both mydomain.com and *.mydomain.com to my NAS.

<VirtualHost *:80>
ServerName redir.example.com
ProxyPass /pbay/ www.anothersite.example.com/ ProxyPassReverse /pbay/ www.anothersite.example.com/ </VirtualHost>


when I try to visit redir.example.com/pbay/,it is redirecting to anothersite.example.com/ and the address bar still shows redir.example.com/pbay/ as intended. But when I do anything on the site which results in another request to the server, the address bar is changing to real (anothersite.example.com) address. I want to always show only redir.example.com/.
I thought that is what ProxyPassReverse is for. How can I achieve this?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Fox8124981

1 Comments

Sorted by latest first Latest Oldest Best

 

@BetL925

You would also need to enable mod_proxy_html. ProxyPassReverse only rewrites the HTTP headers. To rewrite the content of the HTML (such as absolute links), you need to enable the additional module.

The documentation for ProxyPassReverse states this pretty clearly:


This directive lets Apache httpd adjust the URL in the Location,
Content-Location and URI headers on HTTP redirect responses. This is
essential when Apache httpd is used as a reverse proxy (or gateway) to
avoid by-passing the reverse proxy because of HTTP redirects on the
backend servers which stay behind the reverse proxy.

Only the HTTP response headers specifically mentioned above will be
rewritten. Apache httpd will not rewrite other response headers, nor
will it by default rewrite URL references inside HTML pages. This
means that if the proxied content contains absolute URL references,
they will by-pass the proxy. To rewrite HTML content to match the
proxy, you must load and enable mod_proxy_html.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme