Table of Contents

Class ApplicationForwardedHeadersOptions

Namespace
ProjectTemplate.Web.Options
Assembly
ProjectTemplate.Web.dll

Configuration settings for forwarded headers support.

public sealed class ApplicationForwardedHeadersOptions
Inheritance
ApplicationForwardedHeadersOptions
Inherited Members

Fields

SectionName

Configuration section name for forwarded headers settings.

public const string SectionName = "ProjectTemplate:ForwardedHeaders"

Field Value

string

Properties

AllowedHosts

Allowed host values from X-Forwarded-Host. Only needed when XForwardedHost is enabled.

public string[] AllowedHosts { get; set; }

Property Value

string[]

ClearKnownNetworksAndProxies

Clears default known proxies/networks before applying configured values. For production, set this to true and explicitly configure trusted proxies/networks.

public bool ClearKnownNetworksAndProxies { get; set; }

Property Value

bool

Enabled

Enables or disables forwarded headers middleware.

public bool Enabled { get; set; }

Property Value

bool

ForwardLimit

Limits the number of forwarded header entries processed. Keep this low unless the proxy chain is well understood.

public int? ForwardLimit { get; set; }

Property Value

int?

Headers

Forwarded header values to process. Valid values include XForwardedFor, XForwardedProto, XForwardedHost, and XForwardedPrefix.

public string[] Headers { get; set; }

Property Value

string[]

KnownNetworks

Trusted proxy networks in CIDR notation. Example: 10.0.0.0/24

public string[] KnownNetworks { get; set; }

Property Value

string[]

KnownProxies

Exact proxy IP addresses trusted to send forwarded headers.

public string[] KnownProxies { get; set; }

Property Value

string[]

RequireExplicitProxyTrust

Gets or sets a value indicating whether startup must fail outside Development when forwarded client IP processing and rate limiting are enabled without an explicitly configured trusted proxy or network.

public bool RequireExplicitProxyTrust { get; set; }

Property Value

bool

RequireHeaderSymmetry

Requires the number of values to match across forwarded headers.

public bool RequireHeaderSymmetry { get; set; }

Property Value

bool