mirror of
https://github.com/caddyserver/caddy.git
synced 2025-04-24 05:44:04 +08:00
caddyhttp: Add {prefixed_query}
placeholder
This commit is contained in:
parent
22b9d51268
commit
533a77c3fd
@ -60,6 +60,7 @@ func placeholderShorthands() []string {
|
||||
"{method}", "{http.request.method}",
|
||||
"{path}", "{http.request.uri.path}",
|
||||
"{query}", "{http.request.uri.query}",
|
||||
"{prefixed_query}", "{http.request.uri.prefixed_query}",
|
||||
"{remote}", "{http.request.remote}",
|
||||
"{remote_host}", "{http.request.remote.host}",
|
||||
"{remote_port}", "{http.request.remote.port}",
|
||||
|
@ -186,6 +186,11 @@ func addHTTPVarsToReplacer(repl *caddy.Replacer, req *http.Request, w http.Respo
|
||||
return path.Ext(req.URL.Path), true
|
||||
case "http.request.uri.query":
|
||||
return req.URL.RawQuery, true
|
||||
case "http.request.uri.prefixed_query":
|
||||
if req.URL.RawQuery == "" {
|
||||
return "", true
|
||||
}
|
||||
return "?" + req.URL.RawQuery, true
|
||||
case "http.request.duration":
|
||||
start := GetVar(req.Context(), "start_time").(time.Time)
|
||||
return time.Since(start), true
|
||||
|
Loading…
x
Reference in New Issue
Block a user