最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Strict CSP(Content-Security Policy) with nonce method not working Angular V18.1 Build Chunk files - Stack Overflow

programmeradmin1浏览0评论

I tried all the prod configuration in angular files also. it's not working:

"optimization": true,
"sourceMap": false,
"outputHashing": "all",
"namedChunks":false

solution with strict csp policy without applying the inline

I'm Working as a full stack of Angular + django stack

As per VA they are recommending to implement a strict CSP Policy.

The below policy is blocking that angular build files

CSP_DEFAULT_SRC = ("'self'",)
CSP_SCRIPT_SRC = ("'self'","'nonce-rAnd0m'")
CSP_STYLE_SRC = ("'self'","'nonce-rAnd0m'",)
CSP_PRELOAD_SRC = ("'self'","'nonce-rAnd0m'")
CSP_IMG_SRC = ("'self'", "data:")
CSP_FONT_SRC = ("'self'",)

This error is showing

Refused to apply inline style because it violates the following Content Security Policy directive: "style-src 'self' 'nonce-rAnd0m'". Either the 'unsafe-inline' keyword, a hash ('sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU='), or a nonce ('nonce-...') is required to enable inline execution.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论