Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

As a learning exercise in order to understand more about reverse proxy. I decided to use my private cloud server as a reverse proxy server and try to bypass corporate firewall (when I am at work) to allow myself to access gmail.

I have came up with the following Proxy configuration (please dont mind the square brackets):

SSLProxyEngine on
ProxyRequests Off
ProxyVia Off

[Proxy *]
    Order deny,allow
    Deny from all
    Allow from

ProxyPreserveHost On

ProxyPass /qqq
ProxyPassReverse /qqq

ProxyPass /qqqqq
ProxyPassReverse /qqqqq

The outcomes of the above configuration as follows:

  1. When I navigate to, the backend server (Google) simply changes URL and redirects me to Although I have "ProxyPreserveHost On"

  2. When I navigate to, Google does 301 back to my proxy server, which redirects me again to Google and I end up in the loop.

I have read a number of posts here at stackoverflow, but could not extract any helpful info from them:

apache reverse proxy changes url

Proxy Pass: follow redirect on server

How to tell Apache, in reverse proxy mode, to intercept or trap 302 responses from backend server and redirect internally without sending 302 response back to client?

My questions here are:

  1. How to prevent Google from changing the URL, and instead transparently display content

  2. What can I do in order not end up in 301 loop between my proxy server and Google

If you think I have missed/omitted/misunderstand something, please do let me know

Thank you, Alex

share|improve this question

migrated from Jul 31 '11 at 8:16

This question came from our site for professional and enthusiast programmers.

1 Answer 1

I have done that by the following code. You can try it...

    ProxyPreserveHost On
    <Proxy *>
            AddDefaultCharset off
            Order deny,allow
            Deny from all
          Allow from all

            ProxyPass /google
            ProxyHTMLURLMap /google

    <Location /google>
            ProxyPassReverse /
            ProxyHTMLInterp On
            ProxyHTMLURLMap  /      /google
            RequestHeader    unset  Accept-Encoding
share|improve this answer

Your Answer


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