diff options
author | Chirag Maheshwari <34106488+chir4gm@users.noreply.github.com> | 2022-08-07 09:33:37 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-06 22:03:37 -0600 |
commit | d26559316fa6fae880351637365f07947a2b79f6 (patch) | |
tree | 1da2ac269d13f48b30d0232f4e28069c02fc9e87 /modules/caddyhttp/reverseproxy | |
parent | 2642bd72b7ca35b8622824fdffced2aefe1aaf11 (diff) |
Replace strings.Index with strings.Cut (#4932)
Diffstat (limited to 'modules/caddyhttp/reverseproxy')
-rw-r--r-- | modules/caddyhttp/reverseproxy/reverseproxy.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/caddyhttp/reverseproxy/reverseproxy.go b/modules/caddyhttp/reverseproxy/reverseproxy.go index c800b39..8887511 100644 --- a/modules/caddyhttp/reverseproxy/reverseproxy.go +++ b/modules/caddyhttp/reverseproxy/reverseproxy.go @@ -658,8 +658,8 @@ func (h Handler) addForwardedHeaders(req *http.Request) error { // Client IP may contain a zone if IPv6, so we need // to pull that out before parsing the IP - if idx := strings.IndexByte(clientIP, '%'); idx >= 0 { - clientIP = clientIP[:idx] + if before, _, found := strings.Cut(clientIP, "%"); found { + clientIP = before } ip := net.ParseIP(clientIP) if ip == nil { |