summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/replacer.go
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2020-06-30 11:42:55 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2020-06-30 11:43:01 -0600
commit77f233a4840afb8b081d12b083b19ed314fd975a (patch)
treeb7c2e2895ce143315598469e07cec15e044c672d /modules/caddyhttp/replacer.go
parentddd690de4cc133bc728f765b2492ccb54f9d84ca (diff)
caddyhttp: Corrected host label index check (fix #3502)
Diffstat (limited to 'modules/caddyhttp/replacer.go')
-rw-r--r--modules/caddyhttp/replacer.go2
1 files changed, 1 insertions, 1 deletions
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