Every resource served from a web server is associated with MIME type (also called content-type). There is a possibility to execute style sheet and steal content from another site through content type doesn’t match. You may prevent this vulnerability in Internet Explorer or Google Chrome by adding nosniff in the header. In this quick guide, I will explain how to add X-Content-Type-Options header in Apache HTTP, Nginx, IHS & Shared hosting to reduce MIME types attack risk.
Few things
Take a backup of an existing configuration file to restore if something goes wrong. To verify the header response, you may use the HTTP Header Checker online tool. If you are using cloud-based Security Protection like SUCURI, then you don’t have to worry, as this is already enabled by default.
Apache and IBM HTTP Server
Modify the httpd.conf file and ensure mod_headers.so is enabled. The following line should be uncommented.
Add following parameter
Save the configuration file and restart Apache to take effects.
Here is how the header response looks like.
Nginx Web Server
Add the following parameter in nginx.conf under server block
Save the nginx.conf file and restart Nginx to see the results.
Implementation in Shared Hosting
If you are using shared hosting like SiteGround or anyone who offers .htaccess file.
Login to your cPanel and go to File Manager Modify .htaccess file and add the following
Save the file and refresh the page to see the results.
I hope this adds a layer of security to your site.