Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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.mydomain.com
    ProxyPass /pbay/ http://www.anothersite.com/
    ProxyPassReverse /pbay/ http://www.anothersite.com/
</VirtualHost>

when I try to visit "redir.mydomain.com/pbay/",it is redirecting to http://www.anothersite.com/ and the address bar still shows "redir.mydomain.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.com) address.I want to always show only "http://redir.mydomain.com/...."

I thought that is what ProxyPassReverse is for. How can I achieve this? Thanks in advance.

share|improve this question
    
I wonder what pbay could be –  Andrew Smith Jun 7 at 14:31

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.