开发者

Nginx locations - case insensitive with spaces

My question is about nginx "location" configuration blocks:

If I want to make a location with a space character (well, %20) in the URL I can do it like so:

location ^~ "/Style Library/" {
}

If I want to make a case-insensitive location, I can do it like so:

location ~* ^/StyleLibrary/ {
}

However, I can't find a way of getting case-insensitive locations with space characters working. None of these appear to work:

location ~* "^/Style Library/" {
}

location ~* ^/Style[^_]Library/ {
}

locatio开发者_开发问答n ~* ^/Style\sLibrary/ {
}

location ~* ^/Style.Library/ {
}

Can anyone help?


Do you have other regex locations that may be handling the request earlier in the server block? I just ran a test locally and was able to make the following location work:

location ~* "^/Style Library/" {
  rewrite ^ /dump.php;
}

where /dump.php is just a simple script that does a var_export($_SERVER);

I tested this with

curl -i "dev/StYlE LiBrArY/"

I'd guess that some other location is handling the request instead of that regex location.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜