Skip to content
This repository has been archived by the owner on Nov 1, 2018. It is now read-only.

Disable header symmetry check on azure #189

Merged
merged 1 commit into from
May 23, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ public static IWebHostBuilder UseIISIntegration(this IWebHostBuilder app)
services.Configure<ForwardedHeadersOptions>(options =>
{
options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;

// https://github.com/aspnet/IISIntegration/issues/140
// Azure Web Sites needs to be treated specially as we get an imbalanced set of X-Forwarded-* headers.
// We use the existence of the %WEBSITE_INSTANCE_ID% environment variable to determine if we're running
// in this environment, and if so we disable the symmetry check.
var isAzure = !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("WEBSITE_INSTANCE_ID"));
options.RequireHeaderSymmetry = !isAzure;
});
});
}
Expand Down