From 77f233a4840afb8b081d12b083b19ed314fd975a Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Tue, 30 Jun 2020 11:42:55 -0600 Subject: caddyhttp: Corrected host label index check (fix #3502) --- modules/caddyhttp/replacer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/caddyhttp/replacer.go') diff --git a/modules/caddyhttp/replacer.go b/modules/caddyhttp/replacer.go index b3c7b5d..f595021 100644 --- a/modules/caddyhttp/replacer.go +++ b/modules/caddyhttp/replacer.go @@ -172,7 +172,7 @@ func addHTTPVarsToReplacer(repl *caddy.Replacer, req *http.Request, w http.Respo reqHost = req.Host // OK; assume there was no port } hostLabels := strings.Split(reqHost, ".") - if idx > len(hostLabels) { + if idx >= len(hostLabels) { return "", true } return hostLabels[len(hostLabels)-idx-1], true -- cgit v1.2.3