[HOW TO] Add Secure Header to Your Website

It is important to protect your visitor by securing your own site. Learn how which security headers are suitable for your site.

It is important to protect your visitor by securing your own site. There are some methods we already known. Such as issue a SSL certificate, force https, HSTS settings. Here are some tags to make your website more security and these are easy to implement.

  • Strict-Transport-Security
  • X-Frame-Options
  • X-Content-Type-Options
  • Referrer-Policy
  • Feature-Policy
  • Content-Security-Policy
Header NameDescriptionRecommended Value
Strict-Transport-SecurityHTTP Strict Transport Security (HSTS) is a feature to support on your site and strengthens your implementation of TLS by getting the User Agent to enforce the use of HTTPS.max-age=31536000;
X-Frame-OptionsX-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.sameorigin
X-Content-Type-OptionsX-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”.nosniff
Referrer-PolicyReferrer 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.no-referrer
Feature-PolicyFeature Policy is a new header that allows a site to control which features and APIs can be used in the browser. No recommended value, click here to learn more.
Content-Security-PolicyContent 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.No recommended value, click here to learn more.

To use these headers:

  • Use it as a side-wide header like:
Strict-Transport-Security: max-age=31536000;
  • Use it as an meta tag:
<meta http-equiv="Strict-Transport-Security" content="max-age=31536000;">
I'm JokerM.
This post was written by me.
To report a copyright issue or abuse, please contact [email protected]
Table of Contents

Subscribe
Notify of
guest

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

0 Comments
Inline Feedbacks
View all comments