mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-27 14:13:48 +03:00
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.
This commit is contained in:
parent
d418e319ab
commit
2eda21ec6d
4 changed files with 2 additions and 9 deletions
|
@ -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++ {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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},
|
||||
|
|
Loading…
Reference in a new issue