mpl*_*jan 2 pdf internet-explorer-10
很长时间以来,人们都知道 IE 会发送多个对 PDF 和其他需要插件的 MIME 类型的请求
现在我们的服务器进程出现异常,因为 IE 突然决定发送 HEAD 请求
这是请求。
Key Value
Request HEAD http://myserver.com/document.pdf HTTP/1.1
Accept */*
User-Agent contype
Accept-Encoding gzip, deflate
Host myserver.com
Content-Length 0
DNT 1
Proxy-Connection Keep-Alive
Pragma no-cache
Run Code Online (Sandbox Code Playgroud)
处理其他 MIME 类型时是否发生了某些变化?
根据这篇文章:
和这篇文章:
和其他人有同样的问题:
IE 曾经对内容类型发出 GET 请求,但现在(从 IE9 开始?在 IE10 中肯定)已更改为 HEAD 请求。
有必要更改您的服务器进程以期待 HEAD 请求。两者 HEAD并GET用的用户代理请求contype应仅返回内容类型,而不是数据
PHP示例:
if($_SERVER['HTTP_USER_AGENT'] == 'contype') {
header('Content-Type: image/svg+xml'); // or application/pdf for pdf
die();
}
Run Code Online (Sandbox Code Playgroud)