diff --git a/caddyconfig/httpcaddyfile/httptype.go b/caddyconfig/httpcaddyfile/httptype.go index 33a37d31..bec50459 100644 --- a/caddyconfig/httpcaddyfile/httptype.go +++ b/caddyconfig/httpcaddyfile/httptype.go @@ -101,7 +101,7 @@ func (st ServerType) Setup(originalServerBlocks []caddyfile.ServerBlock, "{scheme}", "{http.request.scheme}", "{file}", "{http.request.uri.path.file}", "{dir}", "{http.request.uri.path.dir}", - "{query}", "{http.request.uri.query_string}", + "{query}", "{http.request.uri.query}", ) for _, segment := range sb.block.Segments { for i := 0; i < len(segment); i++ { diff --git a/modules/caddyhttp/caddyhttp.go b/modules/caddyhttp/caddyhttp.go index 8ff2fb60..ab217cbd 100644 --- a/modules/caddyhttp/caddyhttp.go +++ b/modules/caddyhttp/caddyhttp.go @@ -66,7 +66,6 @@ func init() { // `{http.request.orig.path.dir}` | The request's original directory // `{http.request.orig.path.file}` | The request's original filename // `{http.request.orig.uri.path}` | The request's original path -// `{http.request.orig.uri.query_string}` | The request's original full query string (with `?`) // `{http.request.orig.uri.query}` | The request's original query string (without `?`) // `{http.request.orig.uri}` | The request's original URI // `{http.request.port}` | The port part of the request's Host header @@ -79,7 +78,6 @@ func init() { // `{http.request.uri.path.dir}` | The directory, excluding leaf filename // `{http.request.uri.path.file}` | The filename of the path, excluding directory // `{http.request.uri.path}` | The path component of the request URI -// `{http.request.uri.query_string}` | The full query string (with `?`) // `{http.request.uri.query.*}` | Individual query string value // `{http.request.uri.query}` | The query string (without `?`) // `{http.request.uri}` | The full request URI diff --git a/modules/caddyhttp/replacer.go b/modules/caddyhttp/replacer.go index 09837be5..cea820d0 100644 --- a/modules/caddyhttp/replacer.go +++ b/modules/caddyhttp/replacer.go @@ -104,8 +104,6 @@ func addHTTPVarsToReplacer(repl *caddy.Replacer, req *http.Request, w http.Respo return dir, true case "http.request.uri.query": return req.URL.RawQuery, true - case "http.request.uri.query_string": - return "?" + req.URL.RawQuery, true // original request, before any internal changes case "http.request.orig_method": @@ -128,9 +126,6 @@ func addHTTPVarsToReplacer(repl *caddy.Replacer, req *http.Request, w http.Respo case "http.request.orig_uri.query": or, _ := req.Context().Value(OriginalRequestCtxKey).(http.Request) return or.URL.RawQuery, true - case "http.request.orig_uri.query_string": - or, _ := req.Context().Value(OriginalRequestCtxKey).(http.Request) - return "?" + or.URL.RawQuery, true } // hostname labels diff --git a/modules/caddyhttp/reverseproxy/fastcgi/caddyfile.go b/modules/caddyhttp/reverseproxy/fastcgi/caddyfile.go index f78a405d..ca0d6cca 100644 --- a/modules/caddyhttp/reverseproxy/fastcgi/caddyfile.go +++ b/modules/caddyhttp/reverseproxy/fastcgi/caddyfile.go @@ -149,7 +149,7 @@ func parsePHPFastCGI(h httpcaddyfile.Helper) ([]httpcaddyfile.ConfigValue, error }), } rewriteHandler := rewrite.Rewrite{ - URI: "{http.matchers.file.relative}{http.request.uri.query_string}", + URI: "{http.matchers.file.relative}?{http.request.uri.query}", } rewriteRoute := caddyhttp.Route{ MatcherSetsRaw: []caddy.ModuleMap{rewriteMatcherSet},