I have a web application(ASP.NET Core MVC) which communicates with my REST API. Both of them are configured to use Azure Active Directory.
Now I'm trying to configure Azure Front Door for the app, but I get the following error:

or this one:

I designed the front door for http-s redirection, configured the backend pool for website to use its own host name.

I've also configured the forwarded headers:
services.Configure<ForwardedHeadersOptions>(options =>
{
options.ForwardedHeaders =
ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
options.KnownNetworks.Clear();
options.KnownProxies.Clear();
// Put your front door FQDN here and any other hosts that will send headers you want respected
options.AllowedHosts = new List<string>() { "<my front door here>" };
});
...
app.UseForwardedHeaders();
However still getting the error. Any ideas?
Thanks.
Blazor .NET 7 / December 2022 Update
I had the same issue FrontDoor + AzureAD + Front Door
On Program.cs
builder.Services.Configure<ForwardedHeadersOptions>(options =>
{
options.ForwardedHeaders =
ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto | ForwardedHeaders.XForwardedHost;
options.KnownNetworks.Clear();
options.KnownProxies.Clear();
// Put your front door FQDN here and any other hosts that will send headers you want respected
options.AllowedHosts = new List<string>() { "stage.x.y.com", "dev.x.y.com", "myapp.azurewebsites.net" };
});
...
builder.Services.Configure<CookiePolicyOptions>(options =>
{
options.CheckConsentNeeded = context => true;//add if consent needed
options.MinimumSameSitePolicy = SameSiteMode.None; // else try SameSiteMode.Lax;
options.Secure = CookieSecurePolicy.Always;
});
then Added app.UseForwardedHeaders(); and app.UseCookiePolicy(); in this order.
app.UseForwardedHeaders();
app.UseHttpsRedirection();
app.UseDefaultFiles();
app.UseStaticFiles();
app.UseCookiePolicy();
app.UseRouting();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With