Apache2 mod_proxy without 301 moved permanently

apache-2.2mod-proxyreverse-proxy

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 http://192.168.1.27/GTM
ProxyPassReverse /GTM http://192.168.1.27/GTM

wget localhost/GTM:

--2011-09-27 21:54:22--  localhost/GTM
Resolving localhost... ::1, 127.0.0.1
Connecting to localhost|::1|:80... failed: Connection refused.
Connecting to localhost|127.0.0.1|: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

Best Answer

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.