Welcome! Log In Create A New Profile

Advanced

NGINX uri encoding problem, can't match a map of uri's with request uri

Posted by petterik 
NGINX uri encoding problem, can't match a map of uri's with request uri
May 03, 2024 09:43AM
I have a nginx map of a bunch of uri's that I want to redirect to another uri. The problem is some of them uri's has uri encoded chars like %20 or %29. Now what's going on is that nginx gives me the request uri but its uri decoded meaning for example its giving me "/blogpost/november twentysixth" instead of "/blogpost/november%20twentysixth" which is needed to match the uri in the map. I have a total of 53k uri's to redirect so don't say we should just do location ... with every single uri.

I appreciate any response and help, this is pretty urgent so please reply fast.

I tried to rewrite the url to filter out the whitespace etc but that caused problems because I then had duplicated uris. (Causing nginx to not start anymore and returning an error)

I tried to implement Lua but probably not the right way or it just didn't work.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 96
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready