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

I am experiencing some issues with apache and mod_rewrite. The server I am running is using apache on centos. The same server is running Windows as a virtual machine.

My current setup allows me to access: on the centos server and on the virtual machine using the following configuration:

RewriteEngine On
RewriteRule ^/windows(.*)$$1 [P]

However, when accessing all request get rewritten as GET request therefore any POST data is lost.

Is there anyway for me to retain my POST data?

Any help is greatly appreciated! Thank you.

share|improve this question
Do you mean request data in a POST, or query params in the URL? This config will lose query string parameters, but won't touch the contents of a POST. – Shane Madden Nov 15 '11 at 16:20
@ShaneMadden Weirdly enough it leaves query parameters where they are, but the apache server seems to send the browser a 302 redirect. Any ideas how to do the redirect internally? – Ben Nov 16 '11 at 0:06

1 Answer 1

up vote 1 down vote accepted

What's the 302 look like? There's a few options here: it may be Apache, or the server that's getting proxied to, or an intended behavior of the application that's handling the request on the backend server.

Option A:

Apache will send a 302 to add a trailing slash if it needs to, but since this resource matches a proxy rule, it shouldn't care.

Option B:

If the request is for just, then the request gets sent to the backend as - this needs to have a slash after the IP to be a valid request, so no web server could be blamed for kicking back a 302 to add one.

Option C:

Keep in mind that a redirect isn't necessarily indicative of a failure condition in a POST request - some applications are designed to do it, to prevent accidental double-posts by users. See here from details.

Do some digging in logs and see which it is.

Oh, and your configuration is vulnerable to the vulnerability described in CVE-2011-3368 - a request for, for instance, would send the request to - ends up being treated as the user specification, is treated as the host, and an attacker can get to any internal host that your proxy can see.

Try this config - this should both fix trailing slash issues if option B above is the problem, as well as resolving your exposure to the vulnerability:

RewriteRule ^/windows/?(.*?)$$1 [P]
share|improve this answer
Thank you very much for your long comment. I have figured out a different solution using ProxyPass /windows and for now it seems to be working fine. Is there any downside to using the ProxyPass? – Ben Nov 16 '11 at 3:19
@Ben Not at all! It's functionally equivalent to the RewriteRule that I provided, is less computationally expensive, and avoids the vulnerability as well - for some reason I had assumed that you needed to stick to mod_rewrite, or I would have recommended using ProxyPass in my answer. – Shane Madden Nov 16 '11 at 3:22

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.