Pdf – IE10 unexpectedly sends a HEAD request for PDF. What has changed

internet-explorer-10pdf

For a long time it was known that IE sends multiple requests for PDF and other MIME types that needs a plugin

Now our server process gives exception because IE suddenly decided to send HEAD requests

Here is the request.

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

Has something changed in the processing of other MIME types?

Best Answer

According to this article:

PRB: Three GET Requests Are Sent When You Retrieve Plug-in Served Content

and this article:

IE Pitfalls: Document “contype” Requests

and someone else with the same problem:

"contype" user-agent making HEAD requests

IE used to make GET requests for content type but now (since IE9? for sure in IE10) has changed to HEAD request.

It is necessary to change your server process to expect a HEAD request. Both HEAD and GET requests with a user agent of contype should only return a content type and not the data

PHP example:

if($_SERVER['HTTP_USER_AGENT'] == 'contype') {
  header('Content-Type: image/svg+xml'); // or application/pdf for pdf
  die();
}
Related Question