Proxy pass encoding % problem

I am using nginx as a reverse proxy. My requirement is nginx needs to
pass
the url passed by client as-is to the proxy server.
I have set the proxy_pass to hostname:port without the uri part
As per the docs ,If it is necessary to transmit URI in the unprocessed
form
then directive proxy_pass should be used without URI part

Despite this,nginx does some sort of processing on the uri.The
percentages
get escaped and are replaced by %25.

Example: Client url - http://10.10.10.10:90/this%2Bthat/

proxy_pass - http://10.10.2.50:8080

Uri sent by nginx after processing - /this%25bthat/

Additionaly,when client passes latin characters like %EA,proxy_pass
further
encodes to some random value which cannot be processed by the client.
Note that changing charset isn’t of much help here.

Any insights,approaches to circumvent this is highly appreciated.

Posted at Nginx Forum:

Hello!

On Tue, May 07, 2013 at 05:45:50AM -0400, Krupa wrote:

proxy_pass - http://10.10.2.50:8080

Uri sent by nginx after processing - /this%25bthat/

Additionaly,when client passes latin characters like %EA,proxy_pass further
encodes to some random value which cannot be processed by the client.
Note that changing charset isn’t of much help here.

Any insights,approaches to circumvent this is highly appreciated.

Symptoms you describe suggests there are rewrites in you config
which mess up things. Note that proxy_pass even without URI will
have to re-encode URI if you change it with rewrites.


Maxim D.
http://nginx.org/en/donation.html

There are no rewrite policies.
location /gw_proxy {
#internal;
#resolver 8.8.8.8;
proxy_http_version 1.1;
proxy_pass http://50.112.76.185:9001;
proxy_pass_request_body off;
proxy_set_header Content-Length 0;
}

invoke nginx with this url :
http://54.245.39.250:8081/gw_proxy/test%2Btest/
uri sent by nginx : /gw_proxy/test%252btest/

local res = ngx.location.capture(“/gw_proxy” … ngx.var.request_uri, {
method = ngx_methods[gw_method],
body = “”,
vars = {
}
});

This is my configuration. Please advise.

Posted at Nginx Forum:

Try issuing the directive;
proxy_set_header

proxy_set_header Host $host:$proxy_port;

Posted at Nginx Forum:

Hello!

On Tue, May 07, 2013 at 06:48:11AM -0400, Krupa wrote:

invoke nginx with this url :
http://54.245.39.250:8081/gw_proxy/test%2Btest/
uri sent by nginx : /gw_proxy/test%252btest/

Works fine here. Quote from debug log:


2013/05/07 16:12:53 [debug] 36830#0: *1 http request line: “GET
/gw_proxy/test%2btest/ HTTP/1.1”

2013/05/07 16:12:53 [debug] 36830#0: *1 test location: “/gw_proxy”
2013/05/07 16:12:53 [debug] 36830#0: *1 using configuration “/gw_proxy”

2013/05/07 16:12:53 [debug] 36830#0: *1 http proxy header:
"GET /gw_proxy/test%2btest/ HTTP/1.1
Content-Length: 0

That is, request line sent to a backend is identical to one got
from a client.

You may want to check if you have problems on client and/or
backend instead. In any case, looking into nginx debug log might
be helpful.


Maxim D.
http://nginx.org/en/donation.html