pdf - MS Edge (Chromium) 不显示设置了内容安全策略 (ERR_BLOCKED_BY_CLIENT) 的 PDF 文档
问题描述
我有一个 Web 应用程序,它提供显示 PDF 的链接。Content-Security-Policy 在 apache 配置 (httpd.conf) 中设置
我现在的问题是在 MS Edge(基于铬)中没有打开/显示 PDF。在 Firefox 中,单击链接会打开新选项卡并加载并显示 PDF。在 MS Edge 中,单击链接会打开新选项卡,但显示错误:
example.domain.org is blocked
Requests to the server have been blocked by an extension.
Try disabling your extensions.
ERR_BLOCKED_BY_CLIENT
没有安装扩展,隐身模式也是如此。
在测试了 Content-Security-Policy 之后,似乎基于 chromium 的浏览器确实处理了与 FireFox 非常不同的 CSP“沙盒”。如果没有“沙盒”策略,它就像在 Firefox 中一样工作。
Header set Content-Security-Policy "base-uri 'self' example.domain.org.com; default-src 'self' example.domain.org.com; form-action 'self' example.domain.org.com; frame-src http://example.domain.org.com; font-src 'self' https://fonts.googleapis.com/ https://fonts.gstatic.com/ https://fonts.googleapis.com/css data:; img-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' https://fonts.googleapis.com 'unsafe-inline'; sandbox allow-forms allow-scripts allow-same-origin allow-popups;"
有没有办法添加基本的 CSP 沙箱(使用诸如 allow-forms allow-scripts allow-same-origin allow-popups 之类的说明符)但仍允许在基于 chromium 的浏览器中打开 PDF?
或者仅通过 httpd.conf 中的一些配置删除 PDF 的 CSP 沙箱?
解决方案
推荐阅读
- visual-studio-2019 - 无法安装 Visual Studio 2019 - 引导安装程序失败
- excel - 隐藏列切换
- python - 如何添加一个整数值上升每个项目python
- twitter - 使用 JSON 的 Hugo Shortcode 抛出“坏字符 U+0022 错误”
- python - 如何自动从 Heroku 上的 git 子模块中提取最新提交?
- json - 有没有办法将传入的 JSON 数据与本地 JSON 数据进行比较?
- redis - 有没有办法使用 Redis 将属性与聊天消息相关联?
- java - 无法将 setOnClickListener 添加到导航抽屉中的按钮
- go - Go:将 gob 与 zmq4 一起使用
- powershell - 我如何从附加的 CSV 文件中的 DistinguishedName 列中过滤“OU = 服务帐户”:powershell