Use this class whenever you are accessing a URL that can belong to any domain or some untrusted domain.
This use case addresses two distinct security scenarios. For requests to external endpoints, the policy enforces that IP addresses are not internal or special-use addresses, preventing URLs from being abused to gain access to internal resources. For requests to backend resources, the policy blocks all IP addresses except for specific ranges that you expect to see, ensuring that URLs cannot be used to exfiltrate data to unauthorized destinations.
If you instead expect the domain to be a specific, trusted domain, see URIValidator.InDomain.
Definition
The AntiSSRFPolicy allows you to customize security requirements for headers, IP addresses, and protocols. You can configure the policy using built-in settings or define your own custom rules. The policy then provides an HttpMessageHandler that automatically enforces these security requirements on all outgoing requests.