How to group Security Headers for web application using htaccess?

group security headers, web application, htaccessHow to group Security Headers for web application using 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.

<IfModule mod_headers.c>
#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
</IfModule>

X-XSS-Protection, X-Frame-Options, X-Content-Type-Options, Content-Security-Policy, Feature-Policy, Strict-Transport-Security

Sources:
X-XSS-Protection
X-Frame-Options
X-Content-Type-Options
Content-Security-Policy
Referrer-Policy
Feature-Policy
Strict-Transport-Security
Where to test Security Headers of website application?

Shashi Dhar Kumar Experience in Web/software development including client server and implementation using PHP, XML, MySQL and SQL Server. Experience of working on Apache, Linux projects, Javascript, Ajax, Putty, FTP, Remote Connection, XML parsing, Mod-Rewriting, Payment Gateways and shipping modules, Trouble shooting and Manual Testing.

No comments

Leave a Reply

Your email address will not be published. Required fields are marked *