Use of ProxyPassReverse to change Location response header

Posted on

Use of ProxyPassReverse to change Location response header – Problems with loading a website are often blamed on the Internet connection, but even the most perfectly set up network cannot help if there is no service to reply at your destination. One of the most popular HTTP servers used for this task is Apache2. Much of Apache’s popularity can be attributed to its easy installation and use, but never the less it is possible to run into problems with even the easiest of the software. If you’ve encountered an issue loading your web page, follow these simple troubleshooting methods outlined in this guide to attempt to get your web server back up and working again. Below are some tips in manage your apache2 server when you find problem about apache-2.2, mod-rewrite, http, ruby-on-rails, mod-proxy.

I am implementing a reverse http proxy:

This will forward requests to servers based on URI: ->

When a user requests, server1 sends a programatically generated (Ruby Devise Gem) 302 response with the following “Location” value:

I need this to be:

I have implemented the following config in Apache:

ProxyPass "/server1/" ""
ProxyPassReverse "/server1/" ""

as per:

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

But the Location header that is being returned by server1 is still:

Is there something wrong with my config?


Figured it out:

ProxyPass "/server1/" ""
ProxyPassReverse "/server1/" ""

Leave a Reply

Your email address will not be published. Required fields are marked *