summaryrefslogtreecommitdiff
path: root/service/http
diff options
context:
space:
mode:
authorMichaelKo <[email protected]>2020-05-07 14:44:45 +0200
committerGitHub <[email protected]>2020-05-07 14:44:45 +0200
commit8ecb65ee17144fe972db31c9500adaf385fb3866 (patch)
treef4eb0a3e1cdf568d5512fc0da4a139d65e9a5bb4 /service/http
parent4f1630991bccf3b38701e2c7970543bb9c8e1f00 (diff)
Add support of CF-Connecting-IP
Diffstat (limited to 'service/http')
-rw-r--r--service/http/handler.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/service/http/handler.go b/service/http/handler.go
index 802de2c2..eeee5e35 100644
--- a/service/http/handler.go
+++ b/service/http/handler.go
@@ -179,6 +179,10 @@ 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"))
}