Asp.net core Identity + identity server + angular + odata + 权限管理

今天踩了一个坑. 

网站发布后看到了一个 error 

Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'sha256-ZT3q7lL9GXNGhPTB1Vvrvds2xw/kOV0zoeok2tiV23I='".

地址是 https://www.domain.com/connect/checksession

这个是 identity server 处理检查 session 的地址. 

error 表示请求被 csp script-src 保护了, 想执行的 script 没有 match 到 hash sha256 

在本地跑好好的,怎么发布就有问题呢...

原来是因为 production 版本会对 html 进行压缩. 结果这个 hash 不正确了咯. 

我懒得去动 identity server, 所以直接 skip 掉这个路径的压缩.. 

以后有时间才去研究研究呗. 

猜你喜欢

转载自www.cnblogs.com/keatkeat/p/11061072.html