最近发现程式报如下错误:blocked:csp
经过分析,在 Response Headers上发现 CSP设置
content-security-policy: default-src 'self'
原来是设置不允许跨域,于是在程式上添加允许的域名,但不管用,并在 response headers上也可以看到添加的设置:
然后检查浏览上呈现的错误
polyfills.8c151b8375e767ff858f.js:1 Refused to connect to 'https://abc.company.com' 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.
为什么不生效呢?
原来是这个应用使用 r-rpoxy 接入服务,r-proxy上统一做了设置,最后申请修改r-proxy上的设置。