Bugfix due to https not being honored
This commit is contained in:
@@ -4,6 +4,7 @@ using Marten;
|
|||||||
using Microsoft.AspNetCore.Authentication;
|
using Microsoft.AspNetCore.Authentication;
|
||||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||||
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
|
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
|
||||||
|
using Microsoft.AspNetCore.HttpOverrides;
|
||||||
using MudBlazor.Services;
|
using MudBlazor.Services;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
@@ -14,6 +15,18 @@ using Wollmilchsau.Services.Ldap;
|
|||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
|
if (!builder.Environment.IsDevelopment())
|
||||||
|
{
|
||||||
|
builder.Services.Configure<ForwardedHeadersOptions>(options =>
|
||||||
|
{
|
||||||
|
// The application is reachable only through the secured reverse-proxy network.
|
||||||
|
options.ForwardedHeaders = ForwardedHeaders.XForwardedProto;
|
||||||
|
options.ForwardLimit = 1;
|
||||||
|
options.KnownIPNetworks.Clear();
|
||||||
|
options.KnownProxies.Clear();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
var oidcConfiguration = builder.Configuration.GetRequiredSection("OIDC");
|
var oidcConfiguration = builder.Configuration.GetRequiredSection("OIDC");
|
||||||
var oidcScopes = oidcConfiguration.GetSection("Scopes").Get<string[]>()
|
var oidcScopes = oidcConfiguration.GetSection("Scopes").Get<string[]>()
|
||||||
?? throw new ConfigurationException("OIDC:Scopes");
|
?? throw new ConfigurationException("OIDC:Scopes");
|
||||||
@@ -125,6 +138,7 @@ var app = builder.Build();
|
|||||||
// Configure the HTTP request pipeline.
|
// Configure the HTTP request pipeline.
|
||||||
if (!app.Environment.IsDevelopment())
|
if (!app.Environment.IsDevelopment())
|
||||||
{
|
{
|
||||||
|
app.UseForwardedHeaders();
|
||||||
app.UseExceptionHandler("/Error", createScopeForErrors: true);
|
app.UseExceptionHandler("/Error", createScopeForErrors: true);
|
||||||
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
||||||
app.UseHsts();
|
app.UseHsts();
|
||||||
|
|||||||
Reference in New Issue
Block a user