Wildcard in location directive

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


Gents,

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
domain.com/documents/23/582ad23330d63a078c967bc3/-1476160403/DUH/POI/2016-12-13/params?variable=my&var=0&many=other-variables&static=false
.
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