R
R
relgames2012-10-15 15:43:52
Apache HTTP Server
relgames, 2012-10-15 15:43:52

Apache mod_proxy url encoding?

There is a web service that accepts parameters in the URL, like service/{parameter}
There is Apache2 that proxies requests to the service

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

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

Any encoded characters can be passed in the parameters, such as %2f, which means a slash /
The problem is that Apache encodes the slash a second time, and it turns out %252f
[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 localhost :8030/Interface%20GigabitEthernet1%252F0%252F2%20Utilization
If AllowEncodedSlashes is set to On, it will decode the slash and insert it into the URL, which is not correct. How to make Apache pass %2f as is?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
relgames, 2012-10-17
@relgames

Who cares, I decided like this:
AllowEncodedSlashes NoDecode
ProxyPass /webservice balancer://api/webservice nocanon

I
iandriyanov, 2012-10-16
@iandriyanov

issues.apache.org/bugzilla/show_bug.cgi?id=34602#c27

RewriteRule ^(.*)$   index.php?show=$1	[B,L]
In the given example, a request to http://example.com/C++ (or
http://example.com/C%2B%2B) would be redirected internally to
index.php?show=C%2B%2B instead of index.php?show=C++

those. send as is!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question