1 write to _options
Microsoft.AspNetCore.HttpOverrides (1)
ForwardedHeadersMiddleware.cs (1)
62
_options
= options.Value;
40 references to _options
Microsoft.AspNetCore.HttpOverrides (40)
ForwardedHeadersMiddleware.cs (40)
71
if (
_options
.AllowedHosts == null ||
_options
.AllowedHosts.Count == 0)
78
foreach (var entry in
_options
.AllowedHosts)
129
if (
_options
.ForwardedHeaders.HasFlag(ForwardedHeaders.XForwardedFor))
132
forwardedFor = requestHeaders.GetCommaSeparatedValues(
_options
.ForwardedForHeaderName);
136
if (
_options
.ForwardedHeaders.HasFlag(ForwardedHeaders.XForwardedProto))
139
forwardedProto = requestHeaders.GetCommaSeparatedValues(
_options
.ForwardedProtoHeaderName);
140
if (
_options
.RequireHeaderSymmetry && checkFor && forwardedFor!.Length != forwardedProto.Length)
148
if (
_options
.ForwardedHeaders.HasFlag(ForwardedHeaders.XForwardedHost))
151
forwardedHost = requestHeaders.GetCommaSeparatedValues(
_options
.ForwardedHostHeaderName);
152
if (
_options
.RequireHeaderSymmetry
162
if (
_options
.ForwardedHeaders.HasFlag(ForwardedHeaders.XForwardedPrefix))
165
forwardedPrefix = requestHeaders.GetCommaSeparatedValues(
_options
.ForwardedPrefixHeaderName);
166
if (
_options
.RequireHeaderSymmetry
178
if (
_options
.ForwardLimit.HasValue && entryCount >
_options
.ForwardLimit)
180
entryCount =
_options
.ForwardLimit.Value;
216
var checkKnownIps =
_options
.KnownNetworks.Count > 0 ||
_options
.KnownProxies.Count > 0;
252
else if (
_options
.RequireHeaderSymmetry)
266
else if (
_options
.RequireHeaderSymmetry)
268
_logger.LogWarning(3, $"Forwarded scheme is not present, this is required by {nameof(
_options
.RequireHeaderSymmetry)}");
281
else if (
_options
.RequireHeaderSymmetry)
283
_logger.LogWarning(4, $"Incorrect number of x-forwarded-host header values, see {nameof(
_options
.RequireHeaderSymmetry)}.");
295
else if (
_options
.RequireHeaderSymmetry)
297
_logger.LogWarning(5, $"Incorrect number of x-forwarded-prefix header values, see {nameof(
_options
.RequireHeaderSymmetry)}");
310
requestHeaders[
_options
.OriginalForHeaderName] = new IPEndPoint(connection.RemoteIpAddress, connection.RemotePort).ToString();
315
requestHeaders[
_options
.ForwardedForHeaderName] =
321
requestHeaders.Remove(
_options
.ForwardedForHeaderName);
330
requestHeaders[
_options
.OriginalProtoHeaderName] = request.Scheme;
334
requestHeaders[
_options
.ForwardedProtoHeaderName] =
340
requestHeaders.Remove(
_options
.ForwardedProtoHeaderName);
348
requestHeaders[
_options
.OriginalHostHeaderName] = request.Host.ToString();
352
requestHeaders[
_options
.ForwardedHostHeaderName] =
358
requestHeaders.Remove(
_options
.ForwardedHostHeaderName);
368
requestHeaders[
_options
.OriginalPrefixHeaderName] = request.PathBase.ToString();
374
requestHeaders[
_options
.ForwardedPrefixHeaderName] =
380
requestHeaders.Remove(
_options
.ForwardedPrefixHeaderName);
398
if (
_options
.KnownProxies.Contains(address))
402
foreach (var network in
_options
.KnownNetworks)