Jhoose Security – Update to include recommended security headers.

I have updated the module to automatically output the OWASP recommended security headers.

Example response headers

These headers are automatically added to the response but can be configured as required, or even disabled.

Code Configuration

        services.AddJhooseSecurity(_configuration, (securityOptions) => {
            // define the XFrame Options mode
            securityOptions.XFrameOptions.Mode = XFrameOptionsEnum.SameOrigin;
            // disable HSTS
            securityOptions.StrictTransportSecurity.Enabled = false;

Configuration via appSettings

"JhooseSecurity": {
      "ExclusionPaths": [
      "HttpsRedirection": true,
      "StrictTransportSecurity": {
        "MaxAge": 31536000,
        "IncludeSubDomains": true
      "XFrameOptions": {
        "Enabled": false,
        "Mode": 0,
        "Domain": ""
      "XPermittedCrossDomainPolicies": {
        "Mode": 0
      "ReferrerPolicy": {
        "Mode": 0
      "CrossOriginEmbedderPolicy": {
        "Mode": 1
      "CrossOriginOpenerPolicy": {
        "Mode": 2
      "CrossOriginResourcePolicy": {
        "Mode": 1

Managing the server header

The security module doesn’t remove the ‘server header’, this may seem strange, but the approach differs depending on how you are hosting your site. I have included some examples below.

Another consideration, if you are hosting your solution with Optimizely DXP then the CDN will automatically remove the header.


return Host.CreateDefaultBuilder(args)
  .ConfigureWebHostDefaults(webBuilder =>
   webBuilder.ConfigureKestrel(o => o.AddServerHeader = false);


<?xml version="1.0" encoding="UTF-8"?>
            <requestFiltering removeServerHeader="true" />


dotnet add package Jhoose.Security.Admin  --version

2 thoughts on “Jhoose Security – Update to include recommended security headers.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.