AleksandarMihailovic
AleksandarMihailovic

Reputation: 125

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

After upload angular 8 applications on heroku I get no error in the build but in the console error text.

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)

I spent a lot of time trying to solve the problem without success. Help? I read other people's solutions but nothing helped me. How

EDIT EDIT EDIT:

All mesage error

Refused to load the image 'https://MYAPP.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.

Failed to load resource: the server responded with a status of 404 (Not Found)

SOLVED> Ok i am solved this. I have problem with Api Cors from backend but I am using block cors extension which is working in localhost but when is project go to server is not working. I am not have really error message.

Upvotes: 2

Views: 9814

Answers (1)

Farzaneh Torkpichlou
Farzaneh Torkpichlou

Reputation: 2496

Did you check adding the following meta tag in 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'">

Hope this helps :)

Upvotes: 1

Related Questions