Skip to content

Commit

Permalink
Add Cloudflare "CF-Connecting-IP" header
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruben Bisharyan committed Oct 1, 2024
1 parent 773a8cd commit 5a5e86f
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ public static string TryParseUserAgent(this HttpContext httpContext)
"X-Forwarded-Host",
"X-Forwarded-Proto",
"X-Forwarded-Server",
"X-Forwarded-Port"
"X-Forwarded-Port",
"CF-Connecting-IP"
};

var stringBuilder = new StringBuilder();
Expand Down Expand Up @@ -166,7 +167,7 @@ public static decimal TryParseAccuracy(this HttpContext httpContext)

public static string TryParseUserNetworkAddress(this HttpContext httpContext)
{
string[] headersToCheck = ["X-Forwarded-For", "Forwarded", "X-Real-IP"];
string[] headersToCheck = ["CF-Connecting-IP", "X-Forwarded-For", "Forwarded", "X-Real-IP"];

foreach (var header in headersToCheck)
{
Expand Down

0 comments on commit 5a5e86f

Please sign in to comment.