4

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?

2
  • What's the RewriteRule look like? Commented Sep 1, 2012 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
    Commented Sep 1, 2012 at 19:50

1 Answer 1

0

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]
5
  • 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
    Commented Sep 2, 2012 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
    Commented Sep 2, 2012 at 11:09
  • 1
    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
    Commented Sep 2, 2012 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
    Commented Sep 2, 2012 at 23:01
  • 4
    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. Commented Jan 17, 2013 at 23:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .