提问者:小点点

如何将“x-content-type-options:nosniff”添加到web服务器的所有响应标头中


我正在运行一个apache web服务器。我希望将“x-content-type-options:nosniff”添加到来自web服务器的所有响应头中。我怎么能那么做?是否可以对apache配置文件进行更改以实现此目的?


共1个答案

匿名用户

在确保加载了mod_headers之后,只需将其追加到webserver配置中:

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