Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have this very simple reverse proxy rule in Apache 2.2.19:

ProxyPass         /test     http://other.local.machine/test
ProxyPassReverse  /test     http://other.local.machine/test

The problem is that it seems mod_proxy escapes the special characters in the Location header, but the special characters there are already escaped (for example, spaces become %20). So, in the end, a simple space is converted into the fugly sequence %2520.

The reason why the Location headers are already escaped is because they're generated by a RewriteRule directive, that escapes characters by default.

How can I fix this?

share|improve this question
    
What's the RewriteRule look like? –  Shane Madden Sep 1 '12 at 19:21
    
@ShaneMadden Something like RewriteRule /test.htm "/test page.html" [R]. I tried to escape the spaces, but everything gets escaped twice. –  MaxArt Sep 1 '12 at 19:50

1 Answer 1

up vote 0 down vote accepted

Couldn't you just modify your RewriteRule? It has the NE flag to prevent escaping of special characters.

RewriteRule /test.htm "/test page.html" [NE,R]
share|improve this answer
    
I didn't know that, but... It doesn't work, because the browser now escapes the spaces, makes its redirected request, and ProxyPass escapes the %, leading to the exact same result... Oh, the nerves! To be clear, I get two "302 Found" pages. –  MaxArt Sep 2 '12 at 10:56
    
You can replace your ProxyPass with a RewriteRule as well, using the P flag. I would try that, of course using the NE flag in that rule as well. –  brain99 Sep 2 '12 at 11:09
    
Replaced the ProxyPass rule with RewriteRule /test/(.*) http://other.local.machine/$1 [NE,P], and used the NE flag in the proxied machine too, but still got the double escape. The problem here is ProxyPassReverse, which coulnd't be replaces as easily. –  MaxArt Sep 2 '12 at 14:53
    
I think it may all depend on the structure of the local network. It's actually a double reverse proxy, so no wonder it must be something tricky. Thank you for your effort to help me, your answer hasn't solved my problem for now... but it may will when I'll try harder. So +1 and answer accepted. –  MaxArt Sep 2 '12 at 23:01
1  
I don't believe you're supposed to mark questions as answered if it doesn't actually fix the problem. Did you find a solution?! I'm having the same problem. –  Andrew Case Jan 17 '13 at 23:36

Your Answer

 
discard

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.