I\'m running an ASP.NET Core 2.0 application which utilises ASP.NET Identity hosted in Azure App Service behind an Application Gateway.
I\'ve set up a custom domain
Thank you Tratcher for your help on this.
It seems the Azure Application Gateway does not add the X-Forwarded-Host header so adding the app.UseForwardedHeaders()
middleware was futile. Instead, I've added a configuration value that holds the host of my current environment and overrides the 'Host' property of every request with the custom domain.
app.Use((ctx, next) =>
{
ctx.Request.Host = new HostString(options.Value.CustomDomain);
return next();
});
The ASP.NET Identity authentication middleware then uses this value to construct the redirect URL.
I've also written Microsoft some feedback on this issue here, as I'm sure my use case cannot be uncommon.