Thursday, March 15, 2012

Internet Explorer file downloads issue over SSL

Problem
File download fails in IE over SSL(https) protocol. I am posting another issue which I faced couple of days back. And it consumed approximately 4 hours of my time.

Reason
It happens when server response header contains "Pragma: no-cache" and/or "Cache-Control: no-store" or "Cache-Control: no-cache".

This is a known issue in IE and mentioned by Microsoft at http://support.microsoft.com/kb/323308.

Solution
While sending the response set "Pragma: cache" and/or "Cache-Control: Private" depending on the header you are receiving.

To track the response headers in IE you can use Fiddler tool. Or you can switch to Firefox.

I have been working on Struts-2 based web application. I end up implementing interceptor to modify response headers. I placed this interceptor just before workflow interceptor in my default interceptor stack.

Tip
While going through many forums I read it somewhere that above header setting should be used for only for IE and SSL.

Hope it helps.

Enjoy !!! :)