How to group Security Headers for web application using htaccess?
How to group group Security for web application using htaccess?
Group Security Headers htaccess
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”.
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-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”.
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.
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.
Feature Policy is a new header that allows a site to control which features and APIs can be used in the browser.
Strict-Transport-Security HTTP 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.
#X-XSS-Protection Header set X-XSS-Protection "1; mode=block" #X-Frame-Options Header set X-Frame-Options DENY #X-Content-Type-Options Header always set X-Content-Type-Options "nosniff" #Content-Security-Policy Header set Content-Security-Policy "default-src 'self'; script-src 'self';" #Referrer-Policy Header always set Referrer-Policy "same-origin" #Feature-Policy Header always set Feature-Policy "microphone 'none'; payment 'none'; sync-xhr 'self' https://www.mysiteurl.com" #Strict-Transport-Security Header set Strict-Transport-Security "max-age=31536000" env=HTTPS
X-XSS-Protection, X-Frame-Options, X-Content-Type-Options, Content-Security-Policy, Feature-Policy, Strict-Transport-Security
Where to test Security Headers of website application?