Send_file works on Rails2,SSL - except for IE7/6

Quirky stuff here,

The current setup works fine for Firefox 3.6 and IE 8 but balks on
earlier IEs. The files are PDFs, .doc files, and other binaries but up
to several MB:

A. the users’ problem is a minor IE7 quirk: it works to download files
from clicking links, but if you use the URL instead then the browser
stops after a fraction of a second. Refreshing or hitting Return again
downloads it fine.

B. the major problem is when the download progress dialog pops up but
then gives the “Internet Explorer can not download XYZ from (website)”
error box. This is what we see when we try testing - so ‘major’ is that
we cannot directly reproduce it.

We’ve tried combing the net and tried various different headers for the
last day, but even Microsoft seems conflicted about which HTTP Headers
should be used when, and few are specifically talking about SSL (but
MS’s KB says SSL headers are treated differently)…

One thing that worries me is that Cache-Control, Pragma, and a couple
others never show up in Firefox’s LiveHTTPHeaders when we or send_file
set them. I’m only certain they’re set because RSpec tests verify them.

While it seems that checking IE’s internet option “Do not save encrypted
documents…” lets the downloading happen for at least some of the
severe errors (B), that seems like an odd work-around instead of a
global solution.

  1. Has anyone experienced this problem?

  2. What is the fix with HTTP Headers or send_file settings?

Thanks!

— recent complete headers through Live HTTP Headers, supposedly with
Expire=-1 —
HTTP/1.1 200 OK

Date: Thu, 13 Jan 2011 21:59:00 GMT

Server: Apache/2.2.3 (Red Hat)

X-Powered-By: Phusion Passenger (mod_rails/mod_rack) 3.0.1

X-Runtime: 4

Content-Transfer-Encoding: binary

Content-Disposition: attachment; filename=“thefile.pdf”

Status: 200

Content-Type: application/pdf

Set-Cookie: …
Vary: Accept-Encoding

Last-Modified: Wed, 12 Jan 2011 22:03:46 GMT

Content-Length: 3962465

Connection: close

We’ve had the issue before with WAS running a java app.

I believe it’s an issue with cache.
http://support.microsoft.com/kb/323308

Joel, that link is for a client-side solution to a server side problem.
And as it turns out, that header isn’t the problem here.

The actual solution is in Apache you must add a line to the relevant
conf file:
Header unset Vary

Since Apache for some reason keeps adding (even overwriting values
coming from Rails) so Vary comes across as:
Vary: User-Agent, Accept-Encoding

With that in place Vary doesn’t come across anymore and IE6 and IE7
download from a redirect link as they should.

cheers!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs