Wildcard in location directive

piotr.pawlowski nginx-forum at forum.nginx.org
Tue Nov 15 12:04:42 UTC 2016


I am trying to setup location block which has wildcard 'inside' regex. Here
is what I think should work:

        location ~ /documents/(.*)static=false$ {
                proxy_pass          http://upstream;

        location /documents {
                try_files $uri /test.html;
        location = /test.html {
                expires 30s;

Unfortunately first location block is not working for me. My testing URL is
As you can see URI is quite complex, that is why I want to use wildcard.

Any idea why it is not working and how to fix this?

Thank you in advance.

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,270949,270949#msg-270949

More information about the nginx mailing list