proxy_pass and trailing / decode uri

max maxima078 at gmail.com
Thu Mar 8 21:34:36 UTC 2018


Hi,

Sorry if it was already asked but I'd like to know if the only way to
prevent Nginx from decoding uri while using proxy_pass is:
https://stackoverflow.com/a/37584656/3515745

Here is my (simplified) conf:

server {
    server_name domain1.com;

    location / {
        proxy_pass http://127.0.0.1:81;

     }

    location /api {
        proxy_pass http://127.0.0.1:82/;

    }
}

Location "/" is perfectly working. My problem is that "/api" location will
decode special character.
To illustrate my problem:

http://domain1.com/image1.png
=> HTTP 200
http://domain1.com/*api*/resource1.png
=> HTTP 200

http://domain1.com/image1+2.png
=> HTTP 200
http://domain1.com/*api*/resource1+2.png
=> HTTP 404

http://domain1.com/image1 2.png
=> HTTP 200
http://domain1.com/*api*/resource1 2.png
=> HTTP 404

I would like to know how to make my "/api" location respond like "/"
without decoding %?
This solution  https://stackoverflow.com/a/37584656/3515745 seems to be
just a workaround.

Thanks for any hints !

Max
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20180308/5427a0bb/attachment.html>


More information about the nginx mailing list