PHP   发布时间:2022-04-04  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了php-412-X-SendFile交付的文件的前提条件失败大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

对于使用X-SendFile交付给用户的较大视频文件,我的行为很奇怪.服务器响应412-前提条件失败.

如果我禁用X-SendFile,一切正常,因此必须与此相关.

一些代码

$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mime =  finfo_file($finfo, $file_path);

header("Content-type: ". $mimE);
finfo_close($finfo);
header('Content-length: '.filesize($file_path));
header('Content-Disposition: inline; filename="'.basename($file_path).'"');
header('X-Sendfile: ' . $file_path );

标头:

request  URL:[redacted]/8c1ab69235fef2009731481d728a3c37.mp4
request Method:GET
Status Code:412 Precondition Failed
Remote Address:192.168.100.100:80

请求:

Accept:*/*
Accept-Encoding:identity;q=1, *;q=0
Accept-Language:en-US,en;q=0.8,ro;q=0.6,de;q=0.4
Cache-Control:max-age=0
Connection:keep-alive
Cookie:PHPSESSID=rlva81b8gl98flv3r37dd0jtu4
Host:datasolutions.eleap.loc
If-Match:"57e7e64-545404121a47c"
Range:bytes=92078080-
Referer:[redacted]/8c1ab69235fef2009731481d728a3c37.mp4
User-Agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36

响应:

Cache-Control:no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Connection:close
Content-Disposition:inline; filename="8c1ab69235fef2009731481d728a3c37.mp4"
Content-length:0
Content-Type:video/mp4
Date:Wed, 04 Jan 2017 11:08:23 GMT
Expires:Thu, 19 Nov 1981 08:52:00 GMT
Pragma:no-cache
Server:Apache/2.4.20 (Ubuntu)
X-Sendfile:[redacted]/8c1ab69235fef2009731481d728a3c37.mp4

找不到任何有关这是什么原因的暗示,也许你们中的一个一个线索.谢谢.

更新:这仅在Chrome中发生.

解决方法:

加载mp4时遇到类似的问题(不使用X-Send).我发现将Chrome降级到以前的版本(54)后,问题就消失了.几周前发布的新版本55似乎已经引入了此问题.

大佬总结

以上是大佬教程为你收集整理的php-412-X-SendFile交付的文件的前提条件失败全部内容,希望文章能够帮你解决php-412-X-SendFile交付的文件的前提条件失败所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: