簡體   English   中英

防止圖像加載的內容安全策略

[英]Content Security Policy preventing images from loading

我有一個正在加載一些外部資產的快速應用程序,但它們被 CSP 阻止。 我以前從未遇到過這個問題,但這是我第一次在應用程序中使用passport.js 和helm.js 所以這可能與他們的配置有關嗎?

Refused to load the image 'https://fake-url.com' because it violates the following Content Security Policy directive: "img-src 'self' data:".

我嘗試添加一個元標記以允許來自外部來源的圖像,但這似乎沒有效果。 任何幫助,將不勝感激。

你有

content="default-src 'none'

這可以防止從任何來源加載資源。 去掉它。

然后將其更改為:

default-src 'self' fake-url.com';

有關以下 HTTP Content-Security-Policy響應標頭的更多信息:

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy

https://content-security-policy.com/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM