3

We have an apache virtual host www.example.com now Im trying to get www.example.com/mypath to go to load the pages from

www.example1.com using mod_poxy i have it with a base

ProxyPass /mypath http://www.example1.com
ProxyPassReverse /mypath http://www.example1.com

however the link on www.example1.com are all <a href='/xxx/xx'>example link</a>

so when they come back to the www.example.com/mypath the are www.example.com/xxx/xx how can i get them to be www.example.com/mypath/xxx/xx

cheers

1 Answer 1

2

This can be achieved by using mod_proxy_html which is capable of rewriting links. Generally this would not be a problem if your webpage would be using relative paths.

With the module installed you can use a configuration similar to this one

LoadModule proxy_module      modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule headers_module    modules/mod_headers.so
LoadFile   /usr/lib/libxml2.so
LoadModule proxy_html_module modules/mod_proxy_html.so
LoadModule xml2enc_module modules/mod_xml2enc.so

# Disable Proxy Requests since this is not a forward proxy
ProxyRequests off


ProxyPass /mypath/ http://www.example1.com/
ProxyHTMLURLMap http://www.example1.com /mypath

<Location /mypath/>
        ProxyPassReverse /
        ProxyHTMLEnable On
        ProxyHTMLURLMap  /      /mypath/

        # You cannot rewrite gzip compressed streams
        RequestHeader    unset  Accept-Encoding
</Location>

You can read up more about mod_proxy_html here and here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .