Wildcard in location directive

Francis Daly francis at daoine.org
Tue Nov 15 18:31:45 UTC 2016

On Tue, Nov 15, 2016 at 08:03:32AM -0500, piotr.pawlowski wrote:

Hi there,

> OK, so do you know how to achieve my goal?

If my guess at what your goal is is correct, the following might work:

    location ^~ /documents/ {
      if ($arg_static = false) {
        proxy_pass http://upstream;
      try_files $uri /test.html;
    location = /test.html {
      expires 30s;

But if you want to do anything else, you may be better off doing
the "error_page/return/location @" dance from the first example on

Good luck with it,

Francis Daly        francis at daoine.org

More information about the nginx mailing list