拒绝加载图像,因为它违反了以下内容安全策略指令:"default-src 'none'" 。角度 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 有问题,但我正在使用在本地主机中工作的块 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'">

希望这对:)有所帮助

相关内容

最新更新