如何添加“X-Content-Type-Options:nosniff”?来自我的Web服务器的所有响应标头 [英] How can I add "X-Content-Type-Options: nosniff" to all the response headers from my web server

查看:6318
本文介绍了如何添加“X-Content-Type-Options:nosniff”?来自我的Web服务器的所有响应标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行一个apache Web服务器。我想将X-Content-Type-Options:nosniff添加到从我的Web服务器发出的所有响应标头中。我怎样才能做到这一点?是否可以对apache配置文件进行更改以实现此目的?

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?

推荐答案

在确定之后,将其附加到您的Web服务器配置中已加载mod_headers:

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>

这篇关于如何添加“X-Content-Type-Options:nosniff”?来自我的Web服务器的所有响应标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆