NetEscapades.AspNetCore.SecurityHeaders 0.9.0

Middleware for ASP.NET Core to automatically add security headers to requests.

There is a newer version of this package available.
See the version list below for details.
Install-Package NetEscapades.AspNetCore.SecurityHeaders -Version 0.9.0
dotnet add package NetEscapades.AspNetCore.SecurityHeaders --version 0.9.0
<PackageReference Include="NetEscapades.AspNetCore.SecurityHeaders" Version="0.9.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NetEscapades.AspNetCore.SecurityHeaders --version 0.9.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Release Notes


* Add support for Nonce generation for Content-Security-Policy headers. See for details
* Add TagHelpers library for adding nonces and generating hashes for Razor elements (
* Allow using HSTS preload with Strict-Transport-Security
* Allow excluding domains from Strict-Transport-Security. Similar to the Microsoft HstsMiddlewareyou can skip applying Strict-Transport-Security to specific hosts

Breaking Changes:

* All obsolete classes have been removed.
* Many classes have changed namespace to better reflect their location in the project, and also to aid discovery. If you're using the recommended builders and extension methods, you should not have any build-time breaking changes, but the package is not runtime-compatible with previous versions
* The Strict-Transport-Security header is no longer applied to localhost by default. Generally speaking, this isn't something you should do anyway.
* The CSP classes have undergone significant refactoring to allow dynamic values per-request (i.e. nonces). This doesn't affect the main public API, but will impact you if you're working with the low-level infrastructure classes.

See for more details.

Showing the top 4 GitHub repositories that depend on NetEscapades.AspNetCore.SecurityHeaders:

Repository Stars
Orleans is a cross-platform framework for building distributed applications with .NET
Asp.Net Core 2.2 & Angular 7 SPA Fullstack application with plenty of examples. Live demo:
Free and Open Source Ecommerce Shopping Cart solution based on ASP.NET CORE and MongoDB
The .NET Core blog system of, runs on Microsoft Azure

Version History

Version Downloads Last updated
0.10.0 1,552 9/27/2019
0.9.0 131,009 10/28/2018
0.8.0 4,516 10/10/2018
0.7.1 6,246 8/29/2018
0.7.0 40,330 1/14/2018
0.6.0 2,275 12/11/2017
0.5.0 725 12/5/2017
0.4.1 23,127 9/27/2017
0.3.1 36,843 4/14/2017
0.3.0 6,183 3/1/2017
0.2.1 13,081 9/14/2016
0.1.1 704 8/12/2016
0.1.0 436 8/2/2016
0.1.0-beta-0003 340 6/2/2016