helmet: contentSecurityPolicy blocking cdn
when I am using app.use(helmet()) its blocking all other cdn & static urls
but if I use the code below then cdn & static urls working fine.
app.use(
helmet({
contentSecurityPolicy: false,
})
)
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 22 (8 by maintainers)
alright so my final code is below which solved the svg issue too.
the only issue i am facing is in production. api send all request 404 example api path
'/api/user’another issue I have added
google.com&google.co.inbut is there any way use .google. I found it is not workingI’m not sure, but I wouldn’t. If someone serves malicious code on
www.google.evil.com, for example, you’d be vulnerable.It looks like
contentSecurityPolicy: falsedoes work but was blocked by a browser cache issue. If all else fails I’ll use this.More refined, my setup is like this (which does NOT work):
The header looks like this:
Other http calls are working okay, even though they are not included here. So not sure what the issue is.
You can disable helmet content default policy and add policy on LB/Node server
@kerimkaan It looks like you’ll need to enable CORS on the backend. Helmet doesn’t deal with CORS at all, so you may wish to read about CORS on MDN or use the cors package.