aboutsummaryrefslogtreecommitdiffhomepage
path: root/modules
diff options
context:
space:
mode:
authorMatthew Holt <[email protected]>2019-07-08 16:46:55 -0600
committerMatthew Holt <[email protected]>2019-07-08 16:46:55 -0600
commit6dfba5fda82e216cffb117a62fcefbe61cd25a34 (patch)
treefe94109d7e2fe3531ecb994cf52463c540a2c2ad /modules
parentd25008d2c8e2eb5f96b2b37a1cca5b4e140cfe8d (diff)
downloadcaddy-6dfba5fda82e216cffb117a62fcefbe61cd25a34.tar.gz
caddy-6dfba5fda82e216cffb117a62fcefbe61cd25a34.zip
Add path components to HTTP replacer
Diffstat (limited to 'modules')
-rw-r--r--modules/caddyhttp/replacer.go6
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 {