Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Mod_Proxy + 302 Redirects

Posted on 2004-11-02
Medium Priority
Last Modified: 2012-05-05
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/

"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.
Question by:Chireru
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
LVL 38

Expert Comment

ID: 12480322
Need to enable "rewrites in the HTTP Headers"

Please read the following doc:


and fix your problem.


Author Comment

ID: 12482705
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.
LVL 38

Expert Comment

ID: 12489665
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 12493665
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.

Expert Comment

ID: 12553882
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.

Author Comment

ID: 12554416
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).

Accepted Solution

andYetAnotherLoginName earned 1500 total points
ID: 12554567
how about using mod_headers to unset/reset headers?

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses
Course of the Month10 days, 23 hours left to enroll

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question