Matching of special characters in location

Grzegorz Kulewski gk at leniwiec.biz
Mon Nov 9 23:11:28 UTC 2020


W dniu 09.11.2020 o 21:10, Sergey A. Osokin pisze:
> On Mon, Nov 09, 2020 at 03:47:13PM +0100, Grzegorz Kulewski wrote:
>> Hello,
>>
>> Is there any (sane) way to match things like: %e2%80%8b in URL in location?
>> Thank you in advance.
> 
> Hi Grzegorz,
> 
> here is the code snippet (not tested):
> 
> location ~ ^/\xE2\x80\x8E {
>     return 200 "%e2%80%8b matched\n"/;
> }

Thank you. It works.

They key seems to be using regexp match. Regular match doesn't seem to understand escapes. Not sure if (where) it is documented.

-- 
Grzegorz Kulewski



More information about the nginx mailing list