ForwardedHeadersOptions.AllowedHosts Property

Definition

The allowed values from x-forwarded-host. If the list is empty then all hosts are allowed. Failing to restrict this these values may allow an attacker to spoof links generated by your service.

C#
public System.Collections.Generic.IList<string> AllowedHosts { get; set; }

Property Value

Remarks

  • Port numbers must be excluded.
  • A top level wildcard "*" allows all non-empty hosts.
  • Subdomain wildcards are permitted. E.g. "*.example.com" matches subdomains like foo.example.com, but not the parent domain example.com.
  • Unicode host names are allowed but will be converted to punycode for matching.
  • IPv6 addresses must include their bounding brackets and be in their normalized form.

Applies to

Product Versions
ASP.NET Core 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0