首页 > 解决方案 > 在内容安全策略中添加 url

问题描述

我将 CSP 添加到我的项目中。我打电话给一个外部网址:http://xx.xx.xx:3002/socket.io

response.addHeader(HEADER_NAME, "default-src 'self' 'unsafe-inline' 'unsafe-eval'; */socket 'self' 'unsafe-inline' 'unsafe-eval'")

但是在我的浏览器中,我遇到了错误:

/socket.io/?EIO=3&transport=polling&t=NNrFFxf

Content security policy: The options for this page have blocked the loading of a resource 
at https://xx.xx.xx.xx:3002/socket.io/?EIO=3&transport=polling&t=NNrFz_O (default-src).

Content security policy: Unable to process unknown directive '* / socket'

有什么建议吗?

标签: javascriptjavacontent-security-policy

解决方案


推荐阅读