@marcel91200 / caddy Mirror · read-only / commits / 6dfba5fd
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 14, 05:15 UTC

Add path components to HTTP replacer

Matthew Holt committed Jul 8, 2019 at 16:46 UTC 6dfba5fda82e216cffb117a62fcefbe61cd25a34
1 file changed +6
modules/caddyhttp/replacer.go
+6
@@ -79,6 +79,12 @@ func addHTTPVarsToReplacer(repl caddy.Replacer, req *http.Request, w http.Respon
79 key := fmt.Sprintf("http.request.host.labels.%d", len(hostLabels)-i-1)
80 m[key] = label
81 }
82 +
83 + pathParts := strings.Split(req.URL.Path, "/")
84 + for i, label := range pathParts {
85 + key := fmt.Sprintf("http.request.uri.path.%d", i)
86 + m[key] = label
87 + }
88 }
89
90 if w != nil {