Apache mod_proxy url encoding

relgames picture relgames · Oct 15, 2012 · Viewed 9.6k times · Source

I have a REST service that accepts parameters in a form /{parameter}

Also there is Apache2 that forwards requests to the websevice

<VirtualHost *:9091>
  AllowEncodedSlashes NoDecode
  LogLevel debug
  ProxyPass /webservice balancer://api/webservice

  <Proxy balancer://api>
     BalancerMember http://localhost:8030
  </Proxy>
</VirtualHost>

Parameters may contain encoded characters, like %2f (/)

The problem is that Apache encodes these characters again, and Webservice receives %252F instead of %2F

[Mon Oct 15 13:59:24 2012] [debug] mod_proxy_balancer.c(46): proxy: BALANCER: canonicalising URL //api/webservice/Interface GigabitEthernet1%2F0%2F2
[Mon Oct 15 13:59:24 2012] [debug] mod_proxy_balancer.c(581): proxy: BALANCER (balancer://api) worker (http://localhost:8030) rewritten to http://localhost:8030/Interface%20GigabitEthernet1%252F0%252F2%20Utilization

If I request the webservice directtly, Tomcat/Jetty handles it find and service receives correct parameter.

Answer

relgames picture relgames · Jan 15, 2013

Solved by specifying

ProxyPass /webservice balancer://api/webservice nocanon