security - 安全 header 应该在哪里?响应 header 还是请求 header ?

标签 security http-headers content-security-policy request-headers response-headers

安全 header 如

x-content-type-options:nosniff
x-frame-options:SAMEORIGIN
x-ua-compatible:IE=edge, chrome=1
x-xss-protection:1; mode=block

应该是请求头还是响应头?为什么?

最佳答案

浏览器使用所有这些 header (如大多数 http 安全 header )来启用浏览器中的安全功能。

因此它们需要位于服务器发送到浏览器的响应 header 中。

将它们设置在请求 header (从浏览器发送到服务器)中不会执行任何操作,因为服务器不使用它们。

关于security - 安全 header 应该在哪里?响应 header 还是请求 header ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36171924/

相关文章:

linux - linux fork不安全吗

postgresql - 将 byte[] PBEKeySpec 存储到 openshift 齿轮表现不同?

asp.net - 在IIS6下运行的Intranet网站的身份验证问题

javascript - 如何让我的 CSS 和 JS 文件发送 HTTP 响应 header

asp.net-mvc - Google Recaptcha 的内容安全策略 header 指令

security - Fluid Framework 中是否可以有访问规则?

php - php、perl 和 python 中的 HTTP header

http - HTTP Content-Length 与实际 body size 不一致怎么办?

Angular 5 和 CSP - 拒绝将字符串评估为 JavaScript,因为 'unsafe-eval' 不是允许的脚本源

javascript - 如何使 GET 产品与 Strict CSP 兼容?