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 Name | Description | Recommended Value |
Strict-Transport-Security | HTTP 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-Options | 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. | sameorigin |
X-Content-Type-Options | 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”. | nosniff |
Referrer-Policy | 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. | no-referrer |
Feature-Policy | Feature 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-Policy | 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. | 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;">