M
M
MOV_UA2021-01-30 20:27:23
Node.js
MOV_UA, 2021-01-30 20:27:23

After installing helmet, an error occurred while running the openweathermap.org API. What settings for helmet need to be done?

Refused to load the image 'https://openweathermap.org/img/wn/[email protected]' 
because it violates the following Content Security Policy directive: "img-src 'self' data:".

Refused to connect to '<URL>' because it violates 
the following Content Security Policy directive: 
"default-src 'self'". Note that 'connect-src' was not explicitly set, 
so 'default-src' is used as a fallback.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alchen777, 2021-11-08
@alchen777

You can simply disable this option:
// This disables the `contentSecurityPolicy` middleware but keeps the rest.
app.use(
helmet({
contentSecurityPolicy: false,
})
);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question