jpiasetz
jpiasetz

Reputation: 1772

nginx urldecoding slashes in url

Nginx seems to be urldecode and match urls when I sent them. Is there anyway to prevent that?

curl https://localhost/schedule/Joe+%2F+%26+Smith

Is getting matched by

rewrite ^/schedule/([^/]+)/([^/]+)$ /a.php?first=$1&last=$2;

Instead of

rewrite ^/schedule/([^/]+)$ /a.php?fullname=$1;

Upvotes: 1

Views: 737

Answers (1)

Xavier Lucas
Xavier Lucas

Reputation: 2632

You can't do that easily.

From location directive documentation :

The matching is performed against a normalized URI, after decoding the text encoded in the “%XX” form, resolving references to relative path components “.” and “..”, and possible compression of two or more adjacent slashes into a single slash.

Now, you can use the (very) experimental perl module and encode $r->uriback in a custom handler.

Upvotes: 1

Related Questions