Class WebLibHstsExtensions
Registers and activates the WebLib HSTS policy on top of ASP.NET Core's native HSTS support.
Inherited Members
Namespace: Eigenverft.WebLib.Infrastructure.Hosting.Hsts
Assembly: Eigenverft.WebLib.Infrastructure.dll
Syntax
public static class WebLibHstsExtensions
Methods
| Edit this page View SourceAddWebLibHsts(IServiceCollection)
Registers native HSTS services with the Eigenverft 180-day max-age baseline and binds the standard Hsts configuration section.
Declaration
public static IServiceCollection AddWebLibHsts(this IServiceCollection services)
Parameters
| Type | Name | Description |
|---|---|---|
| IServiceCollection | services | The service collection. |
Returns
| Type | Description |
|---|---|
| IServiceCollection | The same service collection. |
Remarks
Configuration is applied after the WebLib baseline. Native HstsOptions defaults, including excluded hosts, remain owned by ASP.NET Core. Middleware activation is intentionally handled separately by UseWebLibHsts(IApplicationBuilder).
AddWebLibHsts(IServiceCollection, Action<HstsOptions>)
Registers native HSTS services and applies code-based configuration after the Hsts configuration section.
Declaration
public static IServiceCollection AddWebLibHsts(this IServiceCollection services, Action<HstsOptions> configure)
Parameters
| Type | Name | Description |
|---|---|---|
| IServiceCollection | services | The service collection. |
| Action<HstsOptions> | configure | Additional HSTS configuration applied last. |
Returns
| Type | Description |
|---|---|
| IServiceCollection | The same service collection. |
UseWebLibHsts(IApplicationBuilder)
Adds ASP.NET Core's native HSTS middleware outside the Development environment.
Declaration
public static IApplicationBuilder UseWebLibHsts(this IApplicationBuilder app)
Parameters
| Type | Name | Description |
|---|---|---|
| IApplicationBuilder | app | The application builder. |
Returns
| Type | Description |
|---|---|
| IApplicationBuilder | The same application builder. |
Remarks
Place this early enough to wrap responses that may short-circuit later in the pipeline, such as rate-limit rejections and health probes. HTTP requests and excluded hosts continue to follow the native ASP.NET Core HSTS middleware semantics.