mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2026-09-30 03:31:27 +02:00
feat: add CF-Connecting-IP as supported real ip header (#2821)
This commit is contained in:
@@ -16,7 +16,9 @@ func GetRealClientIPParser(headerKey string) (ipapi.RealClientIPParser, error) {
|
||||
case http.CanonicalHeaderKey("X-Forwarded-For"),
|
||||
http.CanonicalHeaderKey("X-Real-IP"),
|
||||
http.CanonicalHeaderKey("X-ProxyUser-IP"),
|
||||
http.CanonicalHeaderKey("X-Envoy-External-Address"):
|
||||
http.CanonicalHeaderKey("X-Envoy-External-Address"),
|
||||
// Cloudflare specific Real-IP header
|
||||
http.CanonicalHeaderKey("CF-Connecting-IP"):
|
||||
return &xForwardedForClientIPParser{header: headerKey}, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ func TestGetRealClientIPParser(t *testing.T) {
|
||||
{"X-REAL-IP", "", forwardedForType},
|
||||
{"x-proxyuser-ip", "", forwardedForType},
|
||||
{"x-envoy-external-address", "", forwardedForType},
|
||||
{"cf-connecting-ip", "", forwardedForType},
|
||||
{"", "the http header key () is either invalid or unsupported", nil},
|
||||
{"Forwarded", "the http header key (Forwarded) is either invalid or unsupported", nil},
|
||||
{"2#* @##$$:kd", "the http header key (2#* @##$$:kd) is either invalid or unsupported", nil},
|
||||
|
||||
Reference in New Issue
Block a user