Resolving Client IP Addresses in .NET with Azure Front Door
The X-Forwarded-For Header For situations where knowing the originating public IP (or host name) of a request is needed, .NET provides the Connection property on HttpContext, with a RemoteIpAddress value. Under normal circumstances this is set directly from the incoming request. For example, when running locally under Kestrel this will normally show up as [::1] (IPV6 localhost). Often, modern web apps aren’t serving requests directly but through proxies that can provide security, scalability, or other benefits, like an Azure Front Door CDN....