Skip to content
This repository was archived by the owner on Feb 7, 2025. It is now read-only.

Commit c9ff573

Browse files
authored
Update cloudflarewarp.go
Do not overwrite X-Forwarded For and X-Real Ip when the request comes from a trusted proxy other than of cloudflare
1 parent 51a316e commit c9ff573

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Diff for: cloudflarewarp.go

+4
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ func (r *RealIPOverWriter) ServeHTTP(rw http.ResponseWriter, req *http.Request)
110110
return
111111
}
112112
req.Header.Set(xForwardProto, cfVisitorValue.Scheme)
113+
} else {
114+
req.Header.Set(xCfTrusted, "yes")
115+
r.next.ServeHTTP(rw, req)
116+
return
113117
}
114118
req.Header.Set(xCfTrusted, "yes")
115119
req.Header.Set(xForwardFor, req.Header.Get(cfConnectingIP))

0 commit comments

Comments
 (0)