I am reverse proxying one site to another site. It's working nicely, but on some links it displays the original link. Here is my configuration

Original Site "mysite.com"

Second site configuration which is proxypassed on "mysite.com"

<VirtualHost *:80>
   ServerName test.mysite.com
   ServerAlias www.test.mysite.com test.mysite.com

   ErrorLog /var/log/apache2/test.mysite_log.log
   TransferLog /var/log/apache2/test.mysite-access_log.log
   LogLevel info
   LogFormat "%h %l %u %t \"%r\" %>s %b %T" common

   ProxyPass / http://mysite.com/
   ProxyPass / http://mysite.com/
   ProxyPassReverse / http://mysite.com/

Now, everything is working well, but the problem is that when I go to some specific link it redirects me to original link. For Example, there are two sections on my page: "about-us" and "inquiry". When I click on "about-us" it takes me to "http://test.mysite.com/about-us" which is ok

When I click on "inquiry" it takes me to "http://mysite.com/inquiry" which is not correct it must be "http://test.mysite.com/inquiry".

I think I've missed some thing to add in configuration file but I can't figure it out.

  • Looks like you missed the what you called "original site" configuration. At a first glance you have a double definition of ProxyPass / http://mysite.com/. Additionally you should increase your LogLevel and tail it while calling the pages. Might give some extra informations. – Chris Apr 10 '12 at 9:29

ProxyPassReverse only rewrites HTTP headers. It has nothing to do with full URLs inside original pages.

You may want to use a third party module - say mod_proxy_html.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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