From 5e9d81b507e0beb46b3812e21566bfef79c87af4 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Thu, 12 Dec 2019 15:27:09 -0700 Subject: try_files, rewrite: allow query string in try_files (fix #2891) Also some minor cleanup/improvements discovered along the way --- modules/caddyhttp/reverseproxy/fastcgi/caddyfile.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'modules/caddyhttp/reverseproxy') diff --git a/modules/caddyhttp/reverseproxy/fastcgi/caddyfile.go b/modules/caddyhttp/reverseproxy/fastcgi/caddyfile.go index 8e723b2..699f680 100644 --- a/modules/caddyhttp/reverseproxy/fastcgi/caddyfile.go +++ b/modules/caddyhttp/reverseproxy/fastcgi/caddyfile.go @@ -125,12 +125,12 @@ func parsePHPFastCGI(h httpcaddyfile.Helper) ([]httpcaddyfile.ConfigValue, error redirMatcherSet := caddy.ModuleMap{ "file": h.JSON(fileserver.MatchFile{ TryFiles: []string{"{http.request.uri.path}/index.php"}, - }, nil), + }), "not": h.JSON(caddyhttp.MatchNegate{ MatchersRaw: caddy.ModuleMap{ - "path": h.JSON(caddyhttp.MatchPath{"*/"}, nil), + "path": h.JSON(caddyhttp.MatchPath{"*/"}), }, - }, nil), + }), } redirHandler := caddyhttp.StaticResponse{ StatusCode: caddyhttp.WeakString("308"), @@ -145,7 +145,7 @@ func parsePHPFastCGI(h httpcaddyfile.Helper) ([]httpcaddyfile.ConfigValue, error rewriteMatcherSet := caddy.ModuleMap{ "file": h.JSON(fileserver.MatchFile{ TryFiles: []string{"{http.request.uri.path}", "{http.request.uri.path}/index.php", "index.php"}, - }, nil), + }), } rewriteHandler := rewrite.Rewrite{ URI: "{http.matchers.file.relative}{http.request.uri.query_string}", @@ -159,7 +159,7 @@ func parsePHPFastCGI(h httpcaddyfile.Helper) ([]httpcaddyfile.ConfigValue, error // route to actually reverse proxy requests to PHP files; // match only requests that are for PHP files rpMatcherSet := caddy.ModuleMap{ - "path": h.JSON([]string{"*.php"}, nil), + "path": h.JSON([]string{"*.php"}), } // if the user specified a matcher token, use that -- cgit v1.2.3