Azure Linux Web App(PHP7.4)下载2MB以上文件失败
问题:Azure App Service Linux 大文件下载触发400错误
我们正将网站从小型服务商迁移至Azure,目前除下载2MB以上文件时会出现400错误外,其余业务流程均正常。
已尝试以下排查动作:
- 调整php.ini相关配置
- 在其他Azure Linux容器中复现测试,同样出现该问题
- 检查Azure相关日志,未找到对应错误记录
以下是用于测试的PHP代码片段:
$file = "test.exe"; $quoted = sprintf('"%s"', addcslashes(basename($file), '"\\')); $size = filesize($file); header('Content-Description: File Transfer'); header('Content-Type: application/*'); header('Content-Disposition: attachment; filename=' . $quoted); header('Content-Transfer-Encoding: binary'); header('Connection: Keep-Alive'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . $size); readfile($file);
我们对比了旧服务器的PHP和Apache配置,二者几乎一致,请问遗漏了什么关键配置?
内容的提问来源于stack exchange,提问作者Marcin
相关产品推荐
相关产品推荐

