summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2019-07-08 16:46:55 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2019-07-08 16:46:55 -0600
commit6dfba5fda82e216cffb117a62fcefbe61cd25a34 (patch)
treefe94109d7e2fe3531ecb994cf52463c540a2c2ad
parentd25008d2c8e2eb5f96b2b37a1cca5b4e140cfe8d (diff)
Add path components to HTTP replacer
-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 11f3bdb..57bc880 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 {