summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2020-01-10 17:02:11 -0700
committerMatthew Holt <mholt@users.noreply.github.com>2020-01-10 17:02:11 -0700
commit2eda21ec6d44fa2f57e72ef0f02ea29c902d871d (patch)
treeda549a7625c16fa9af172efd7a6e432f30666e92
parentd418e319ab626e4b7dab676a7db3405d24a4b58c (diff)
http: Remove {...query_string} placeholder, in favor of {...query}
I am not sure if the query_string one is necessary or useful yet. We can always add it later if needed.
-rw-r--r--caddyconfig/httpcaddyfile/httptype.go2
-rw-r--r--modules/caddyhttp/caddyhttp.go2
-rw-r--r--modules/caddyhttp/replacer.go5
-rw-r--r--modules/caddyhttp/reverseproxy/fastcgi/caddyfile.go2
4 files changed, 2 insertions, 9 deletions
diff --git a/caddyconfig/httpcaddyfile/httptype.go b/caddyconfig/httpcaddyfile/httptype.go
index 33a37d3..bec5045 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 8ff2fb6..ab217cb 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 09837be..cea820d 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 f78a405..ca0d6cc 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},