[英]Cannot GET /login on reload pages Angular 8 - Refused to load the image '/favicon.ico' because it violates the following Content Security Policy
Getting this error Cannot GET login/ on the page body.出现此错误无法在页面正文上获取登录名/。 How to fix this error in latest angular 8 app.
如何在最新的 angular 8 应用程序中修复此错误。 I have tried all the solutions from the forums but no luck.
我已经尝试了论坛中的所有解决方案,但没有运气。 Any suggestions would be greatly appreciated.
任何建议将不胜感激。
Please note no compilation errors in ng serve, ng biuld --prod
.请注意
ng serve, ng biuld --prod
中没有编译错误。 Below is the chrome console error.下面是 chrome 控制台错误。 This error occurs only on the server url not in localhost.
此错误仅发生在服务器 url 上,不在 localhost 中。
Refused to load the image 'serverUrL/favicon.ico' because it violates the following Content Security Policy directive: "default-src 'none'".
拒绝加载图像“serverUrL/favicon.ico”,因为它违反了以下内容安全策略指令:“default-src 'none'”。 Note that 'img-src' was not explicitly set, so 'default-src' is used as a fallback.
请注意,'img-src' 没有显式设置,因此 'default-src' 用作后备。
Try this..尝试这个..
Method 1方法一
Method 2方法二
Method 3方法三
Update the following code within head section of index.html更新 index.html 的 head 部分中的以下代码
<meta http-equiv="Content-Security-Policy" content="default-src 'self'
https://yourdomain.com;">
Content-Security-Policy (CSP)内容安全策略 (CSP)
CSP Directive: default-src CSP 指令:default-src
CSP value: 'self' (Restrict source to same origin) CSP 值:'self'(将源限制为同源)
References参考
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.