Problem with downloading files with Internet Explorer over HTTPS
This behaviour has bitten me before. Yesterday I was asked to resolve the issue again. And as my memory is short I was again forced to search the web for a solution. The solution is simple – but also stupid.
The problem is that Internet Explorer does not handle file dowloads without caching over https very well. Or at all. According to knowledge articles on Microsofts website the problem occurs when having one or two of the http headers:
Pragma: no-cache Cache-control: no-cache,max-age=0,must-revalidate
Previously I have have just omitted the http header “Pragma: nocache” for IE but it seems it does not always help.
So, whether you want it or not, the solution to the IE https download cache problem is to tell IE to cache the file.
if ((isset($_SERVER["HTTPS"]) && strtolower($_SERVER["HTTPS"] == "on")) &&
preg_match("/MSIE/", $_SERVER["HTTP_USER_AGENT"])) {
header('Pragma: cache');
} else {
header('Pragma: no-cache');
}
If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.
Comments
3 Responses to “Problem with downloading files with Internet Explorer over HTTPS”Trackbacks
Check out what others are saying about this post...-
[...] the DotVoid.com blog Danne shares a quick tip on forcing downloads over HTTPS to Internet Explorer (which, of course, has to be difficult about [...]

or instead of the
header(“Pragma: no-cache”);
send a
header(“Expires: 0″);
This is a well-known issue in IE for many-many years. In the past I used the following code when I had to serve a file from PHP:
if (isset($_SERVER["HTTPS"])) {
header(“Pragma: “);
}