Skip to content
Branch: master
Find file History
pascalandy and mholt Added security-header example (#141)
* Added security-header example

* typo

* added warning section

* using bold

* typo

* Added a warning
Latest commit b0e2975 Dec 11, 2018
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
Caddyfile Added security-header example (#141) Dec 12, 2018
README.md Added security-header example (#141) Dec 12, 2018

README.md

Security Header

Get an A+ on security header out of the box. These settings are well tested on websites in PROD.

Before using this setup, I was using CloudFlare worker (5$ per month) to get the same result. I asked myself, how can I configure security header on my own server instead. This is how.

Warning

Test those default values locally as they could prevent your website functioning normally.

  • Content Security Policy is an effective measure to protect your site from XSS attacks. By whitelisting sources of approved content, you can prevent the browser from loading malicious assets. Analyse this policy in more detail. You can sign up for a free account on Report URI to collect reports about problems on your site.
  • Feature Policy is a new header that allows a site to control which features and APIs can be used in the browser.
  • Referrer Policy is a new header that allows a site to control how much information the browser includes with navigations away from a document and should be set by all sites.
  • HTTP Strict Transport Security is an excellent feature to support on your site and strengthens your implementation of TLS by getting the User Agent to enforce the use of HTTPS. ⚠️ Warning - it requires that the site is served over HTTPS for the duration specified in the header. Failing to do so will brick users out of the site.
  • X-Content-Type-Options stops a browser from trying to MIME-sniff the content type and forces it to stick with the declared content-type. The only valid value for this header is "X-Content-Type-Options: nosniff".
  • X-Frame-Options tells the browser whether you want to allow your site to be framed or not. By preventing a browser from framing your site you can defend against attacks like clickjacking.
  • X-XSS-Protection sets the configuration for the cross-site scripting filters built into most browsers. The best configuration is "X-XSS-Protection: 1; mode=block".
  • Expect-CT Expect-CT allows a site to determine if they are ready for the upcoming Chrome requirements and/or enforce their CT policy.
  • Server Typically you will see values like "Microsoft-IIS/8.0" or "nginx 1.7.2".

Screenshot:

screen shot 2018-12-06 at 7 48 19 pm

This is part of my project: 📦 A smaller Caddy docker image 14MB + (security header, gzip, cache, healthcheck)

Cheers! https://twitter.com/askpascalandy

You can’t perform that action at this time.