dthyxna3894 2014-04-29 14:55
浏览 329

为错误页面提供X-Content-Type-Options标头?

I'm using a security scanning tool to check for vulnerabilities of my web application.

One of the results was a low warning about X-Content-Type-Options header being missing.

After some digging around, I found this post on setting apache to emit nosniff headers and I put this code in to httpd.conf file;

<IfModule mod_headers.c>
  Header unset ETag
  Header set X-Frame-Options: deny
  Header set X-XSS-Protection: "1; mode=block"
  Header set X-Content-Type-Options: nosniff
  Header set X-WebKit-CSP: "default-src 'self'"
  Header set X-Permitted-Cross-Domain-Policies: "master-only"
</IfModule>

And it worked! But then, my security scanning tool discovered that the 404 Not Found page on my web server was still giving me this warning. I'm guessing that the 404 error page is set to ignore the above rule somehow..

Can someone explain to me how to change this code or suggest an alternative so that error pages are included?

Could someone also maybe explain what the code above is doing? I don't actually know what IfModule or mod_headers.c actually means. Maybe that's why I'm having trouble in the first place.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 thinkphp6配合social login单点登录问题
    • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
    • ¥15 如何在scanpy上做差异基因和通路富集?
    • ¥20 关于#硬件工程#的问题,请各位专家解答!
    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配
    • ¥15 Power query添加列问题
    • ¥50 Kubernetes&Fission&Eleasticsearch