IE, SSL and file downloads

Posted: June 21st, 2012 | Author: | Filed under: PHP | Comments Off on IE, SSL and file downloads

A small reminder for everyone developing applications using SSL (Secure Sockets Layer) for data encryption: When downloading files Internet Explorer has to use it’s cache in order to be able to open the file. states:

In order for Internet Explorer to open documents in Office (or any out-of-process, ActiveX document server), Internet Explorer must save the file to the local cache directory and ask the associated application to load the file by using IPersistFile::Load. If the file is not stored to disk, this operation fails.

When Internet Explorer communicates with a secure Web site through SSL, Internet Explorer enforces any no-cache request. If the header or headers are present, Internet Explorer does not cache the file. Consequently, Office cannot open the file.

This means that IE should always be forced to cache the file before opening. In PHP this is achieved by sending the following HTTP headers,:

// Do not use header("Pragma: no-cache");
header("Pragma: private");
// Do not use header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: cache");