Remove HSTS
This commit is contained in:
1 parent
613e1fbf47
commit
0b1d31b2b0
2 files changed
+11
-17
No files matched your search
+11
-11
@@ -83,16 +83,16 @@ builder.Services.AddScoped<AppState>();
|
||||
builder.Services.AddCascadingAuthenticationState();
|
||||
|
||||
// HSTS
|
||||
if (bool.Parse(Environment.GetEnvironmentVariable("ENABLE_HSTS") ?? "false"))
|
||||
{
|
||||
builder.Services.AddHsts(options =>
|
||||
{
|
||||
var hstsSection = builder.Configuration.GetSection("Hsts");
|
||||
options.MaxAge = TimeSpan.FromDays(hstsSection.GetValue<int>("MaxAgeDays", 365));
|
||||
options.IncludeSubDomains = hstsSection.GetValue<bool>("IncludeSubDomains", true);
|
||||
options.Preload = hstsSection.GetValue<bool>("Preload", false);
|
||||
});
|
||||
}
|
||||
//if (bool.Parse(Environment.GetEnvironmentVariable("ENABLE_HSTS") ?? "false"))
|
||||
//{
|
||||
// builder.Services.AddHsts(options =>
|
||||
// {
|
||||
// var hstsSection = builder.Configuration.GetSection("Hsts");
|
||||
// options.MaxAge = TimeSpan.FromDays(hstsSection.GetValue<int>("MaxAgeDays", 365));
|
||||
// options.IncludeSubDomains = hstsSection.GetValue<bool>("IncludeSubDomains", true);
|
||||
// options.Preload = hstsSection.GetValue<bool>("Preload", false);
|
||||
// });
|
||||
//}
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddRazorComponents()
|
||||
@@ -112,8 +112,8 @@ if (!app.Environment.IsDevelopment())
|
||||
{
|
||||
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.
|
||||
if (bool.Parse(Environment.GetEnvironmentVariable("ENABLE_HSTS") ?? "false")) app.UseHsts();
|
||||
}
|
||||
|
||||
app.UseStatusCodePagesWithReExecute("/not-found");
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
|
||||
@@ -16,12 +16,6 @@
|
||||
"Twitter": "",
|
||||
"Mastodon": ""
|
||||
},
|
||||
"Hsts": {
|
||||
"Domain": "nas.oneputleygreen.com",
|
||||
"MaxAgeDays": 365,
|
||||
"IncludeSubDomains": true,
|
||||
"Preload": false
|
||||
},
|
||||
"Authentication": {
|
||||
"Google": {
|
||||
"ClientId": "",
|
||||
|
||||
Reference in new issue
Block a user