[英]Header CSP (content-security-policy) not correct
我的網站javascript出現問題,在主頁上,bootstrap中的下拉框不起作用,但是在子目錄上,它似乎運行得很好...我的CSP標頭如下:
script-src 'self' //ajax.cloudflare.com
根據我對CSP文檔的理解; 空格將允許一個指令中有多個條目。 “腳本-src”
我沒有得到的是為什么它在主頁上不起作用。 我在這里茫然。
錯誤:
index.php:10 Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self' //ajax.cloudflare.com". Either the 'unsafe-inline' keyword, a hash ('sha256-safag'), or a nonce ('nonce-...') is required to enable inline execution.
固定於:
$cspheader = "'default-src':'none' 'script-src':'self' 'unsafe-eval' //ajax.cloudflare.com/'font-src': 'self' 'connect-src':'self' 'img-src':'self' 'style-src':'self' 'media-src':'self'";
header("Content-Security-Policy: ". $cspheader);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.