Browse Source

Add path components to HTTP replacer

master
Matthew Holt 6 years ago
parent
commit
6dfba5fda8
No known key found for this signature in database GPG Key ID: 2A349DD577D586A5
  1. 6
      modules/caddyhttp/replacer.go

6
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 {

Loading…
Cancel
Save