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?

MaxArt
  • 515
  • 1
  • 7
  • 14

1 Answers1

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]
brain99
  • 1,792
  • 12
  • 19
  • 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 02 '12 at 10:56
  • You can replace your ProxyPass with a RewriteRule as well, using the [P flag](http://httpd.apache.org/docs/2.2/rewrite/flags.html#flag_p). I would try that, of course using the NE flag in that rule as well. – brain99 Sep 02 '12 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 Sep 02 '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 02 '12 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. – Andrew Case Jan 17 '13 at 23:36