问题
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?
回答1:
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>
回答2:
what i did is this. i place the tags right after commented out property modules/mod_headers.so and restart my appserver but still the same response header.
LoadModule headers_module modules/mod_headers.so
<Directory mod_headers.c>
Header always set X-Content-Type-Options nosniff
</Directory>
来源:https://stackoverflow.com/questions/21322295/how-can-i-add-x-content-type-options-nosniff-to-all-the-response-headers-from