在url中使用nginx urldecoding斜杠

时间:2014-10-31 23:08:14

标签: nginx

当我发送它们时,Nginx似乎是urldecode并匹配网址。反正有没有阻止它?

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

匹配

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

而不是

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

1 个答案:

答案 0 :(得分:1)

你不能轻易做到这一点。

From location directive documentation :

  

在解码以“%XX”形式编码的文本,解析对相对路径组件“。”和“..”的引用,以及可能将两个或多个相邻斜杠压缩为一个斜线。

现在,您可以在自定义处理程序中使用(非常)实验perl module并编码$r->uri

相关问题