diff options
author | Matthew Holt <[email protected]> | 2019-07-08 16:46:55 -0600 |
---|---|---|
committer | Matthew Holt <[email protected]> | 2019-07-08 16:46:55 -0600 |
commit | 6dfba5fda82e216cffb117a62fcefbe61cd25a34 (patch) | |
tree | fe94109d7e2fe3531ecb994cf52463c540a2c2ad /modules/caddyhttp/replacer.go | |
parent | d25008d2c8e2eb5f96b2b37a1cca5b4e140cfe8d (diff) | |
download | caddy-6dfba5fda82e216cffb117a62fcefbe61cd25a34.tar.gz caddy-6dfba5fda82e216cffb117a62fcefbe61cd25a34.zip |
Add path components to HTTP replacer
Diffstat (limited to 'modules/caddyhttp/replacer.go')
-rw-r--r-- | modules/caddyhttp/replacer.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/caddyhttp/replacer.go b/modules/caddyhttp/replacer.go index 11f3bdb38..57bc880f6 100644 --- a/modules/caddyhttp/replacer.go +++ b/modules/caddyhttp/replacer.go @@ -79,6 +79,12 @@ func addHTTPVarsToReplacer(repl caddy.Replacer, req *http.Request, w http.Respon key := fmt.Sprintf("http.request.host.labels.%d", len(hostLabels)-i-1) m[key] = label } + + pathParts := strings.Split(req.URL.Path, "/") + for i, label := range pathParts { + key := fmt.Sprintf("http.request.uri.path.%d", i) + m[key] = label + } } if w != nil { |