Table of Contents

Class SecurityHeadersMiddleware

Namespace
ProjectTemplate.Web.Middleware
Assembly
ProjectTemplate.Web.dll

Middleware that applies a set of security-related HTTP headers to responses.

public sealed class SecurityHeadersMiddleware
Inheritance
SecurityHeadersMiddleware
Inherited Members

Remarks

The middleware can be configured via ApplicationSecurityHeadersOptions to enable/disable individual headers and to exclude certain request path prefixes.

Constructors

SecurityHeadersMiddleware(RequestDelegate, IOptions<ApplicationSecurityHeadersOptions>)

Middleware that applies a set of security-related HTTP headers to responses.

public SecurityHeadersMiddleware(RequestDelegate next, IOptions<ApplicationSecurityHeadersOptions> options)

Parameters

next RequestDelegate
options IOptions<ApplicationSecurityHeadersOptions>

Remarks

The middleware can be configured via ApplicationSecurityHeadersOptions to enable/disable individual headers and to exclude certain request path prefixes.

Methods

InvokeAsync(HttpContext)

Invokes the middleware for the given context, applying configured security headers to the response when appropriate.

public Task InvokeAsync(HttpContext context)

Parameters

context HttpContext

The current HTTP context.

Returns

Task

A Task that completes when the middleware and the next delegate finish processing.