summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/fileserver
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2020-01-16 11:29:20 -0700
committerMatthew Holt <mholt@users.noreply.github.com>2020-01-16 11:29:20 -0700
commit2466ed148466ee17fb4da6d2d732e1a16f0469a6 (patch)
tree096493a67440a249c240bb6cb39961caf35e5b4c /modules/caddyhttp/fileserver
parenta66f461201ae2b7e724b3067f74019bdf44f834e (diff)
httpcaddyfile: Group try_files routes together (#2891)
This ensures that only the first matching route is used.
Diffstat (limited to 'modules/caddyhttp/fileserver')
-rw-r--r--modules/caddyhttp/fileserver/caddyfile.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/caddyhttp/fileserver/caddyfile.go b/modules/caddyhttp/fileserver/caddyfile.go
index d26b435..67ae4f4 100644
--- a/modules/caddyhttp/fileserver/caddyfile.go
+++ b/modules/caddyhttp/fileserver/caddyfile.go
@@ -163,5 +163,10 @@ func parseTryFiles(h httpcaddyfile.Helper) ([]httpcaddyfile.ConfigValue, error)
result = append(result, makeRoute(try, "")...)
}
+ // ensure that multiple routes (possible if rewrite targets
+ // have query strings, for example) are grouped together
+ // so only the first matching rewrite is performed (#2891)
+ h.GroupRoutes(result)
+
return result, nil
}