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]
Related videos on Youtube
Author by
MaxArt
Updated on September 18, 2022Comments
-
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 aRewriteRule
directive, that escapes characters by default.How can I fix this?
-
Admin almost 12 yearsWhat's the
RewriteRule
look like? -
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 almost 12 yearsI 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 almost 12 yearsYou 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 almost 12 yearsI 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 over 11 yearsI 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.