summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichaelKo <[email protected]>2020-05-07 16:09:10 +0200
committerGitHub <[email protected]>2020-05-07 16:09:10 +0200
commit9272b8c8b4044f551b43ae4fc46a128ca4ec0b4e (patch)
tree215084b0ef0b43e8ee27a7fd2fd400855842627e
parent8ecb65ee17144fe972db31c9500adaf385fb3866 (diff)
fix perfomance issue
-rw-r--r--service/http/handler.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/service/http/handler.go b/service/http/handler.go
index eeee5e35..457e7cb5 100644
--- a/service/http/handler.go
+++ b/service/http/handler.go
@@ -179,11 +179,12 @@ func (h *Handler) resolveIP(r *Request) {
r.RemoteAddr = fetchIP(r.Header.Get("X-Real-Ip"))
}
- if r.Header.Get("CF-Connecting-IP") != "" {
- r.RemoteAddr = fetchIP(r.Header.Get("CF-Connecting-IP"))
- }
-
if r.Header.Get("True-Client-IP") != "" {
r.RemoteAddr = fetchIP(r.Header.Get("True-Client-IP"))
+ return
+ }
+
+ if r.Header.Get("CF-Connecting-IP") != "" {
+ r.RemoteAddr = fetchIP(r.Header.Get("CF-Connecting-IP"))
}
}