diff options
author | Matthew Holt <mholt@users.noreply.github.com> | 2020-01-16 11:29:20 -0700 |
---|---|---|
committer | Matthew Holt <mholt@users.noreply.github.com> | 2020-01-16 11:29:20 -0700 |
commit | 2466ed148466ee17fb4da6d2d732e1a16f0469a6 (patch) | |
tree | 096493a67440a249c240bb6cb39961caf35e5b4c /modules | |
parent | a66f461201ae2b7e724b3067f74019bdf44f834e (diff) |
httpcaddyfile: Group try_files routes together (#2891)
This ensures that only the first matching route is used.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/caddyhttp/fileserver/caddyfile.go | 5 |
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 } |