【发布时间】:2021-04-23 17:02:25
【问题描述】:
我有几个项目文件下载不再起作用。这似乎是由于最近的 Chrome 政策变更所致。
下载尝试失败,控制台中出现此错误:
Mixed Content: The site at 'https://example.com/' was loaded over a secure connection, but the file at 'https://example.com/logs_view.php?export=true' was redirected through an insecure connection. This file should be served over HTTPS. This download has been blocked. See https://blog.chromium.org/2020/02/protecting-users-from-insecure.html for more details.
我的文件是通过 PHP 提供的:
header("Content-Type: application/xls");
header("Content-Disposition: attachment; filename=".$filename.".xls");
header("Pragma: no-cache");
header("Expires: 0");
echo utf8_decode($export);
似乎这种方法不发送带有 HTTPS 标头的文件......关于如何解决这个问题的任何想法?
您可以在服务器响应标头的标头下方找到:
HTTP/1.1 200 OK
Date: Tue, 19 Jan 2021 11:33:14 GMT
Server: Apache
Expires: 0
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Content-Disposition: attachment; filename=base_changelog_2021-01-19_12-33-14.xls
Content-Length: 899
Keep-Alive: timeout=5, max=92
Connection: Keep-Alive
Content-Type: application/xls
非常感谢您的支持。
本
【问题讨论】:
-
这个问题好运吗?我也面临同样的情况\
标签: php google-chrome https http-headers mixed-content