|
@@ -146,7 +146,10 @@ func getClientIP(r *http.Request, strict bool) (net.IP, error) {
|
|
|
var ip string
|
|
|
|
|
|
// Use the client ip from the 'X-Forwarded-For' header, if available.
|
|
|
- if fwdFor := r.Header.Get("X-Forwarded-For"); fwdFor != "" && !strict {
|
|
|
+ if fwdFor := r.Header.Get("CF-Connecting-IP"); fwdFor != "" && !strict {
|
|
|
+ ips := strings.Split(fwdFor, ", ")
|
|
|
+ ip = ips[0]
|
|
|
+ } else if fwdFor := r.Header.Get("X-Forwarded-For"); fwdFor != "" && !strict {
|
|
|
ips := strings.Split(fwdFor, ", ")
|
|
|
ip = ips[0]
|
|
|
} else {
|