Apache ProxyPassReverse escaping special characters

6,740

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:
6,740

Related videos on Youtube

MaxArt
Author by

MaxArt

Updated on September 18, 2022

Comments

  • MaxArt
    MaxArt almost 2 years

    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?

    • Admin
      Admin almost 12 years
      What's the RewriteRule look like?
    • Admin
      Admin almost 12 years
      @ShaneMadden Something like RewriteRule /test.htm "/test page.html" [R]. I tried to escape the spaces, but everything gets escaped twice.
  • MaxArt
    MaxArt almost 12 years
    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.
  • brain99
    brain99 almost 12 years
    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.
  • MaxArt
    MaxArt almost 12 years
    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.
  • Kish
    Kish over 11 years
    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.