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

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to not send a 301 moved permanently response to the client when using mod_proxy? I would like the client to deal with the reverse proxy as opaquely as possible.

My Virtual Host Settings: relevant snippet:

ProxyPreserveHost On
ProxyPass /GTM
ProxyPassReverse /GTM

wget localhost/GTM:

--2011-09-27 21:54:22--  localhost/GTM
Resolving localhost... ::1,
Connecting to localhost|::1|:80... failed: Connection refused.
Connecting to localhost||:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: localhost/GTM/ [following]
--2011-09-27 21:54:22--  localhost/GTM/
Reusing existing connection to localhost:80.
HTTP request sent, awaiting response... 200 OK
share|improve this question

Apache doesn't generate 301s for any reason unless you tell it to with a RewriteRule ... [R=301] or Redirect.

The server that you're proxying to is the one generating the redirects. Try setting ProxyPreserveHost On in Apache, in case the application is attempting to enforce a specific hostname.

share|improve this answer
Had already tried ProxyPreserveHost On in the virtual host. Didn't make a difference. Have edited my question accordingly. I doubt if the backend server is forcing redirect since the wget log finally shows that client is not directed to the backend server and sticks to Proxy URL – Guy Sensei Sep 27 '11 at 16:26
@user96057 Well, that just means that there's nothing that you can do in Apache to stop the redirects. Apache doesn't just send 301s for no reason, and mod_proxy doesn't even have the capability to send them itself. What's the server that you're proxying to? And what's the exact new Location: header sent in the redirect? – Shane Madden Sep 27 '11 at 16:28
the response header has same location as the request URI. What could be causing the redirect? There is no RewriteRule or Redirect in the whole apache2 folder. – Guy Sensei Sep 27 '11 at 17:01
No, it added a trailing slash. Like I said, it's not Apache. The application you're proxying to apparently wants a trailing slash. – Shane Madden Sep 27 '11 at 17:05

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.