Method GetClientLocation
GetClientLocation(HttpContext)
Gets the visitor location that Cloudflare sent with the request, or null if the request did not come through Cloudflare or Cloudflare sent no location.
Declaration
public static CloudflareClientLocation? GetClientLocation(this HttpContext httpContext)
Parameters
| Type | Name | Description |
|---|---|---|
| HttpContext | httpContext | The context of the request. |
Returns
| Type | Description |
|---|---|
| CloudflareClientLocation |
Remarks
A request came through Cloudflare when the middleware added by UseCloudflareForwarding(IApplicationBuilder) verified that its connection came from Cloudflare (or from a trusted proxy, see TrustedProxyNetworks). Without the middleware, every request returns null.