• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1989
  • Last Modified:

Mod_Proxy + 302 Redirects

I'm running into problems using mod_proxy in a reverse proxy configuration where an application on the real servers are sending "302 Found"/Redirects that redirect to the real servername, and break out of the proxy scenario.

Are there any workarounds for this?

        ProxyPass /sub http://realserver
        ProxyHTMLURLMap http://realserver /sub
        Redirect /sub http://proxyserver/sub/
        <Location /sub>
                ProxyPassReverse /
                SetOutputFilter  proxy-html
                ProxyHTMLURLMap  /          /sub/
                ProxyHTMLURLMap  /sub      /sub/
        </Location>

"http://proxyserver/sub/" proxies for "http://realserver/", but realserver sends back 302 Found, Location: http://realserver/differentsub/" which ProxyPassReverse misses, and, since there is no access to realserver from the internet, causes the page not to be found.
0
Chireru
Asked:
Chireru
  • 3
  • 2
  • 2
1 Solution
 
yuzhCommented:
Need to enable "rewrites in the HTTP Headers"

Please read the following doc:

http://www.apacheweek.com/features/reverseproxies

and fix your problem.

0
 
ChireruAuthor Commented:
Read that doc before, actually, most of my configuration is based off of that.  Commands that aren't shown there are in the general config, which is too long to post.
0
 
yuzhCommented:
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

 
ChireruAuthor Commented:
If you look at my configuration above, I use both ProxyPass and ProxyPassReverse..  if you look at the first link you suggested to me (http://www.apacheweek.com/features/reverseproxies), that is what I mainly followed.  I have tried using the ProxyPassReverse outside of the Location directive, but the problem still exists.

I know ProxyPassReverse is working, because if I remove it, the rest of the proxy breaks.

I have all but abandoned this project for now.  I may revisit it later, if I can find a solution to this issue, but unfortunately, with this 302 problem, it cannot be deployed.
0
 
andYetAnotherLoginNameCommented:
wonder why the redirect is a problem, unless clients don't use your server as proxy. are you trying to steal content ;) if so you better use server-side scripting for that.
0
 
ChireruAuthor Commented:
The idea is: I have a whole bunch of internal servers, who's content I want to provide to users, but I want to add security to the mix too.  So, I firewall off everything except for this box, which will accept secure and insecure connections, and use the application servers behind the firewall, hopefully with at-proxy URL filtering and other fancy security options.. once I get it working.

The problem is:  some of the application servers send a 302-Redirect, which includes the full servername and path, which isn't rewritten by the proxy, and sends the user looking for some internal server (which they won't be able to get to).
0
 
andYetAnotherLoginNameCommented:
how about using mod_headers to unset/reset headers?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now