Strange behaviour of %27 encoding in rewrite

aquilinux aquilinux at gmail.com
Wed Nov 14 14:54:20 UTC 2018


Hi all,
i'm seeing a strange behaviour in nginx rewrite involving encoded urls for
*%27*
I have this type of rewrite:

rewrite "^/brands/l-oreal$"
> https://somedomain.tld/L%27Or%C3%A9al-Paris/index.html? permanent;
>

That translates to this:


>  [~]> curl -kIL https://mydomain.tld/brands/l-oreal
> HTTP/2 301
> server: nginx
> date: Wed, 14 Nov 2018 14:44:21 GMT
> content-type: text/html
> content-length: 178
> *location: https://somedomain.tld/L'Or%C3%A9al-Paris/index.html
> <https://somedomain.tld/L'Or%C3%A9al-Paris/index.html>*
> strict-transport-security: max-age=15768000; includeSubDomains


 If i change %27 to %20 i have:

[~]> curl -kIL https://mydomain.tld/brands/l-oreal
> HTTP/2 301
> server: nginx
> date: Wed, 14 Nov 2018 14:31:09 GMT
> content-type: text/html
> content-length: 178
> *location: https://somedomain.tld/L%20Or%C3%A9al-Paris/index.html
> <https://somedomain.tld/L%20Or%C3%A9al-Paris/index.html>*
> strict-transport-security: max-age=15768000; includeSubDomains


as expected.

The same strange behaviour applies to *%2C*, that is decoded to "*,*"
instead of being passed unencoded, as expected.
This is driving me nuts, can anyone explain (or fix) this?

Thanks!


-- 
"Madness, like small fish, runs in hosts, in vast numbers of instances."

Nessuno mi pettina bene come il vento.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20181114/af4f34c5/attachment.html>


More information about the nginx mailing list