Thursday, January 15, 2009

IE 7 behaviour when passed pdf via https

We have had a very odd issue with IE7 being sent pdf files over https.

Standard headers that look like this :

Cache-Control: no-cache, must-revalidate
Content-Disposition: attachment;filename=mysecretpdffile.pdf
Content-Type: application/pdf
Content-Length: 19180
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive

Work fine under IE 5/5.5/6, Opera, Safari et al, but IE 7 reports that the content is not available.

After a bit of searching I found an excellent post at :

http://in2.php.net/manual/en/function.header.php#74736

For us adding the following headers in Java have resolved the issue :

response.setHeader( "Pragma", "public" );
response.setHeader( "Content-Transfer-Encoding", "binary" );
response.setHeader( "Expires", "0" );
response.setHeader( "Cache-Control", "must-revalidate, post-check=0, pre-check=0" );

No comments: