Nginx – url encoding with nginx

nginx

Nginx changes my server's behavior.
My configuration file is the following:

server {
  server_name XXX ;
  location / {
    proxy_pass http://127.0.0.1:8080 ;
  }
}
server {
  listen 443;
  # ssl parameters
  server_name XXX ;
  location / {
    proxy_pass https://127.0.0.1:8081 ;
  }
}

My server answers a page showning the url requested.
When I try http://XXX/a+b, the '+' is turned into a ' ' (space character), not when I try https://XXX/a+b
And to be sure that it comes from nginx, I tried with https://127.0.0.1:8081/a+b and http://127.0.0.1:8080/a+b, they both show the '+'.

How can I specify in nginx configuration not to decode/encode urls ?

Best Answer

To properly pass a literal + symbol through a URL, you must encode it as %2B.

I don't see anything in the proxy_pass documentation allowing you to tune the URL encoding.

Related Topic