Part of DKNet.AspCore.Extensions. AddHttpsConfig registers HSTS options and the feature marker. UseHttpsConfig installs HSTS followed by HTTPS redirection when marked. It supplies no TLS certificate or HTTPS listener.
using DKNet.AspCore.Extensions.Hosting;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddHttpsConfig(builder.Configuration);
var app = builder.Build();
app.UseHttpsConfig();
Console.WriteLine("HttpsConfig pipeline configured.");
| Input | Type | Default | Effect |
|---|---|---|---|
Https:HstsMaxAgeDays |
number | 365 | Default HSTS MaxAge; includes subdomains and enables preload at 365 days or more. |
configureOptions |
Action<HstsOptions>? |
null | Replaces the helper’s HSTS defaults with the supplied framework options callback. |