【发布时间】:2021-02-02 07:57:55
【问题描述】:
我已经使用 WsFedration(ADFS) 在我们的应用程序中集成了单点登录 注销后,它会重定向到成功注销并返回登录页面的页面。 在 Windows 服务器中托管后,此操作正常,但在托管后,到 Nginx 服务器我遇到了问题,它没有重定向到登录页面,控制台错误说,
拒绝框架“https://xxx-yyy.zzz.rr/”,因为它违反了以下内容安全策略指令:“default-src 'self'”。请注意,'frame-src' 没有显式设置,因此 'default-src' 用作后备
然后我对此进行搜索并将内容安全策略 (CSP) 添加到 Nginx 配置文件中,如下所示。
add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options SAMEORIGIN always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Content-Security-Policy "style-src-elem 'unsafe-inline' 'self' https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css https://fonts.googleapis.com/css";
add_header Content-Security-Policy "style-src 'unsafe-inline' 'self' https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css https://fonts.googleapis.com/css";
add_header Content-Security-Policy "frame-src 'unsafe-inline' 'self' none";
add_header Content-Security-Policy "default-src 'unsafe-inline' 'self'; https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css https://fonts.googleapis.com/css ";
add_header Content-Security-Policy "frame-ancestors 'self' 'unsafe-inline' none";
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
add_header Content-Security-Policy "font-src 'self' 'unsafe-inline' https://netdna.bootstrapcdn.com https://fonts.gstatic.com";
我尝试了几种方法,但我无法弄清楚,如果有人可以帮助我解决这个问题,非常感谢。 提前致谢。
【问题讨论】: