今天踩了一个坑. html
网站发布后看到了一个 error session
Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'sha256-ZT3q7lL9GXNGhPTB1Vvrvds2xw/kOV0zoeok2tiV23I='".
地址是 https://www.domain.com/connect/checksessiondom
这个是 identity server 处理检查 session 的地址. ide
error 表示请求被 csp script-src 保护了, 想执行的 script 没有 match 到 hash sha256 网站
在本地跑好好的,怎么发布就有问题呢...code
原来是由于 production 版本会对 html 进行压缩. 结果这个 hash 不正确了咯. server
我懒得去动 identity server, 因此直接 skip 掉这个路径的压缩.. htm
之后有时间才去研究研究呗. blog