Take the 2-minute tour ×
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 xxx.xxx.xxx
[/Proxy]

ProxyPreserveHost On

ProxyPass /qqq https://www.google.com/accounts/ServiceLogin?service=mail
ProxyPassReverse /qqq https://www.google.com/accounts/ServiceLogin?service=mail

ProxyPass /qqqqq http://mail.google.com/mail
ProxyPassReverse /qqqqq http://mail.google.com/mail

The outcomes of the above configuration as follows:

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

  2. When I navigate to myserver.com/qqqqq, 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 stackoverflow.com 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
    </Proxy>

            ProxyPass /google http://www.google.com/
            ProxyHTMLURLMap http://www.google.com /google

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

Your Answer

 
discard

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