From 862857e72559bcec513c7d2b8e4800a699748a2a Mon Sep 17 00:00:00 2001 From: Shreyas Zare Date: Sat, 23 Nov 2024 13:12:54 +0530 Subject: [PATCH] Extensions: updated GetRemoteEndPoint() to remove the conditional private ip check option. --- DnsServerCore/Extensions.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DnsServerCore/Extensions.cs b/DnsServerCore/Extensions.cs index e5017d20..a227e505 100644 --- a/DnsServerCore/Extensions.cs +++ b/DnsServerCore/Extensions.cs @@ -32,7 +32,7 @@ namespace DnsServerCore { readonly static string[] HTTP_METHODS = new string[] { "GET", "POST" }; - public static IPEndPoint GetRemoteEndPoint(this HttpContext context, string realIpHeaderName = null, bool readRealIpHeaderForPrivateIpOnly = true) + public static IPEndPoint GetRemoteEndPoint(this HttpContext context, string realIpHeaderName = null) { try { @@ -43,7 +43,7 @@ namespace DnsServerCore if (remoteIP.IsIPv4MappedToIPv6) remoteIP = remoteIP.MapToIPv4(); - if (!string.IsNullOrEmpty(realIpHeaderName) && (!readRealIpHeaderForPrivateIpOnly || NetUtilities.IsPrivateIP(remoteIP))) + if (!string.IsNullOrEmpty(realIpHeaderName) && NetUtilities.IsPrivateIP(remoteIP)) { //get the real IP address of the requesting client from X-Real-IP header set in nginx proxy_pass block string xRealIp = context.Request.Headers[realIpHeaderName];