簡體   English   中英

拒絕加載圖像,因為它違反了以下內容安全策略指令:“default-src 'none'”。 角度 8

[英]Refused to load the image because it violates the following Content Security Policy directive: "default-src 'none'". Angular 8

在 heroku 上上傳 angular 8 應用程序后,我在構建中沒有錯誤,但在控制台錯誤文本中。

Refused to load the image 'https://MYAPPLICATION.herokuapp.com/favicon.ico' because it violates the following Content Security Policy directive: "default-src 'none'". Note that 'img-src' was not explicitly set, so 'default-src' is used as a fallback.

MYAPPLICATION.herokuapp.com/:1 Failed to load resource: the server responded with a status of 404 (Not Found)

我花了很多時間試圖解決這個問題,但沒有成功。 幫助? 我閱讀了其他人的解決方案,但對我沒有任何幫助。 如何

編輯編輯編輯:

所有信息錯誤

拒絕加載圖像“ https://MYAPP.herokuapp.com/favicon.ico ”,因為它違反了以下內容安全策略指令:“default-src 'none'”。 請注意,未明確設置“img-src”,因此“default-src”用作后備。

加載資源失敗:服務器響應狀態為 404(未找到)

已解決> 好的,我已經解決了。 我在后端使用 Api Cors 有問題,但我使用的是在本地主機上工作的 block cors 擴展,但是項目何時轉到服務器不起作用。 我沒有真正的錯誤信息。

您是否檢查過在 index.html 中添加以下元標記?

<meta http-equiv="Content-Security-Policy" content="default-src 'none'; connect-src 'self';font-src 'self'; img-src 'self' data: https:; style-src 'self' ; script-src 'self'">

希望這可以幫助:)

我被禁止使用cors api。

暫無
暫無

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

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