Nginx location - 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 this:

location ^~ "/Style Library/" {
}

If I want to create a case-insensitive location, I can do it like this:

location ~* ^/StyleLibrary/ {
}

However, I cannot find a way to get case sensitive locations with working spaces. None of them work:

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

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

location ~* ^/Style\sLibrary/ {
}

location ~* ^/Style.Library/ {
}

Can anyone help?

+3
source share
1 answer

Do you have other regex locations that can handle the request earlier in the server block? I just checked the test in place and was able to do the following work:

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

/dump.php - script, var_export ($ _ SERVER);

curl -i "dev/StYlE LiBrArY/"

, .

+3

All Articles