Apache ProxyPassReverse escaping special characters

Posted on

Apache ProxyPassReverse escaping special characters – Managing your servers can streamline the performance of your team by allowing them to complete complex tasks faster. Plus, it can enable them to detect problems early on before they get out of hand and compromise your business. As a result, the risk of experiencing operational setbacks is drastically lower.

But the only way to make the most of your server management is to perform it correctly. And to help you do so, this article will share nine tips on improving your server management and fix some problem about apache-2.2, reverse-proxy, mod-proxy, , .

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?

Solution :

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]

Leave a Reply

Your email address will not be published.