node.js - Chrome 策略指令(内容安全策略):拒绝加载脚本'https://www.paypal.com/sdk/js
问题描述
我有一个使用 Paypal 的反应应用程序。
在 index.html 我有
<script src="https://www.paypal.com/sdk/js?client-id=MYCLIENTID&commit=true&disable-funding=credit,card"></script>
在我的 index.html 文件中。我也在后端(节点js)有以下作为标题:
app.use(function(req, res, next) {
res.setHeader('Content-Security-Policy', "script-src 'self' https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js https://www.paypal.com/");
return next();
});
我也用过
https://www.paypal.com/sdk/js
乃至
https://www.paypal.com/sdk/js?client-id=MYCLIENTID&commit=true&disable-funding=credit,card
在标题上,但我仍然在 Chrome 上收到以下错误。
Mysite.com/:1 Refused to load the script 'https://www.paypal.com/sdk/js?client-id=MYCLIENTID&commit=true&disable-funding=credit,card' because it violates the following Content Security Policy directive: "script-src 'self' my policies links...". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.
任何人都知道我如何在谷歌浏览器的政策中通过 PayPal?谢谢
解决方案
推荐阅读
- python-3.x - pandas 在列上使用 cumsum 并创建一个新的布尔列,将边缘情况标记为 True
- python - 尽管通过循环创建矩阵,但为矩阵乘法创建零矩阵不起作用
- angular - Angular:是否可以在循环模板内创建变量?
- blazor - 如何使用 Blazor 服务器端配置 Azure SignalR?
- asp.net-mvc - 使用授权用户有效,但不使用角色
- c++ - 转换为布尔时没有得到 1
- vba - VBA遍历文件夹中的图像并找到类似的匹配项
- windows - OpenSSL 在配置文件中找不到 distinct_name
- python - 序列化具有属性的函数对象,加载时缺少一个属性
- oracle - Oracle Entity Framework 导致 4K 显示器中的表单缩小