IE file download/streaming issue(and fix)…

I spent some half-an-hour today, cracking this weird problem which showed up only on IE. Finally succeeded and the hacking session ended with a boat load of IE bitching(you saw this coming didn’t you…).

Problem:
Click on a link, that triggers a GET request which to stream/download a file, and if you choose to Save the file on IE, it works… whereas a direct Open(without saving of-course) fails.

Solution:
Stop using HTTP Header Vary on response when its Internet Explorer…
I was dealing with Apache2 fronting mongrels. I used BrowserMatch to make use of UserAgent request header to get the browser name, and selectively re-stamp(smudge) the response header value. Adding this snippet…..

1
BrowserMatch "MSIE" force-no-vary

in httpd.conf(apache configuration file) nailed it….
TIP: You can use Live HTTP Headers(the firefox plugin) to check the response headers. 

Cause & Effect:
Broken as IE is… Vary header with legal(standard values) causes IE to stop caching + it demonstrates some more weird behavior which i didn’t bother to understand(because i think anything to do with Microsoft Software is NOT worth my time)…
The effect is that the streamed file is not available when the handling application(for example AcrobatReader in case of a PDF file) tries to open it… on being invoked by the browser.

About these ads

About this entry