Content Security Policy Internet explorer error

不羁岁月 提交于 2019-12-10 18:47:04

问题


I add Content-Security-Policy its work fine with Chrome, Firefox and Opera but with Internet Explorer 11 i have this error "This page can’t be displayed"

add_header Content-Security-Policy "connect-src 'self' wss://example.com/ws/;
                                    script-src 'self' 'unsafe-inline' 'unsafe-eval' https://www.google-analytics.com https://www.google.com https://www.gstatic.com/recaptcha/api2/recaptcha__en.js https://ajax.cloudflare.com/cdn-cgi/nexp/cloudflare.min.js;
                                    frame-src 'self' https://www.terminal.com/embed/chart-widget/ https://www.google.com/recaptcha/;
                                    img-src 'self' https://www.google-analytics.com https://chart.googleapis.com https://shape.com;
                                    ";

if i comment this section its work with IE

Why i have this error only with IE ? Thanks you


回答1:


Refering to caniuse content security policy is only partially supported through the X-Content-Security-Policy header, but not through the standard Content-Security-Policy header. Try using X-Content-Security-Policy header in IE...




回答2:


The issue is having new lines in your config block.

Make it a single config line and it should work fine.



来源:https://stackoverflow.com/questions/33736665/content-security-policy-internet-explorer-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!