Remove HSTS

This commit is contained in:
rossmill76 committed 2026-03-07 11:32:36 +00:00
1 parent 613e1fbf47
commit 0b1d31b2b0
2 files changed
+11 -17

No files matched your search

+11 -11
View File
@@ -83,16 +83,16 @@ builder.Services.AddScoped<AppState>();
builder.Services.AddCascadingAuthenticationState(); builder.Services.AddCascadingAuthenticationState();
// HSTS // HSTS
if (bool.Parse(Environment.GetEnvironmentVariable("ENABLE_HSTS") ?? "false")) //if (bool.Parse(Environment.GetEnvironmentVariable("ENABLE_HSTS") ?? "false"))
{ //{
builder.Services.AddHsts(options => // builder.Services.AddHsts(options =>
{ // {
var hstsSection = builder.Configuration.GetSection("Hsts"); // var hstsSection = builder.Configuration.GetSection("Hsts");
options.MaxAge = TimeSpan.FromDays(hstsSection.GetValue<int>("MaxAgeDays", 365)); // options.MaxAge = TimeSpan.FromDays(hstsSection.GetValue<int>("MaxAgeDays", 365));
options.IncludeSubDomains = hstsSection.GetValue<bool>("IncludeSubDomains", true); // options.IncludeSubDomains = hstsSection.GetValue<bool>("IncludeSubDomains", true);
options.Preload = hstsSection.GetValue<bool>("Preload", false); // options.Preload = hstsSection.GetValue<bool>("Preload", false);
}); // });
} //}
// Add services to the container. // Add services to the container.
builder.Services.AddRazorComponents() builder.Services.AddRazorComponents()
@@ -112,8 +112,8 @@ if (!app.Environment.IsDevelopment())
{ {
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.
if (bool.Parse(Environment.GetEnvironmentVariable("ENABLE_HSTS") ?? "false")) app.UseHsts();
} }
app.UseStatusCodePagesWithReExecute("/not-found"); app.UseStatusCodePagesWithReExecute("/not-found");
app.UseHttpsRedirection(); app.UseHttpsRedirection();
-6
View File
@@ -16,12 +16,6 @@
"Twitter": "", "Twitter": "",
"Mastodon": "" "Mastodon": ""
}, },
"Hsts": {
"Domain": "nas.oneputleygreen.com",
"MaxAgeDays": 365,
"IncludeSubDomains": true,
"Preload": false
},
"Authentication": { "Authentication": {
"Google": { "Google": {
"ClientId": "", "ClientId": "",