Search code examples
javascriptapachehttp-headersmime-typeshttpresponse

How can I add "X-Content-Type-Options: nosniff" to all the response headers from my web server


I am running an apache web server. I would like to add "X-Content-Type-Options: nosniff" to all the response headers going from my web server. How can I do that? Is it possible to make changes to apache config files to accomplish this?


Solution

  • Just append this to your webserver configuration, after making sure mod_headers is loaded:

    <Directory "your_web_server_documents_directory">
        .......
        Header always set X-Content-Type-Options nosniff
        .......
    </Directory>