zoukankan      html  css  js  c++  java
  • Nginx 防止跨站脚本 Cross-Site Scripting (XSS)(漏洞修复)

    Nginx 防止跨站脚本 Cross-Site Scripting (XSS)


    1、修改 nginx 配置

    在 nginx.conf 配置文件中,增加如下配置内容:

    add_header X-XSS-Protection "1; mode=block";

    X-XSS-Protection 的字段有三个可选配置值,说明如下:

    0: 表示关闭浏览器的XSS防护机制
    1:删除检测到的恶意代码, 如果响应报文中没有看到X-XSS-Protection 字段,那么浏览器就认为X-XSS-Protection配置为1,这是浏览器的默认设置
    1; mode=block:如果检测到恶意代码,在不渲染恶意代码

    修改后效果:

    2、重启 nginx 服务

    systemctl restart nginx

    或者

    service nginx restart

  • 相关阅读:
    作业5.1 四则运算----封装
    作业四
    作业2 (完)
    作业3
    作业二。。
    数独
    回答自己的提问
    《一个程序猿的生命周期》读后感
    阅读13-17章
    阅读10,11,12章
  • 原文地址:https://www.cnblogs.com/miracle-luna/p/14274350.html
Copyright © 2011-2022 走看看