[LRUG] Rails, SSL, nginx, Downloads and Internet Explorer

Rory Franklin rory at chillibean.tv
Thu Mar 22 05:10:09 PDT 2012


Turns out that after a morning of unsuccessfully trying to find out how to get this working, just adding the following to my download controller action worked a treat:

expires_in 3.hours, :public => true




Rory


On Thursday, 22 March 2012 at 12:07, mudge wrote:

> One thing that might be worth investigating is the fact that nginx's
> default for the "expires" directive ("off") prevents changes to the
> "Expires" and "Cache-Control" headers (c.f.
> http://wiki.nginx.org/HttpHeadersModule#expires).
> 
> On Thu, Mar 22, 2012 at 11:50 AM, Rory Franklin <rory at chillibean.tv (mailto:rory at chillibean.tv)> wrote:
> > Hi LRUG,
> > 
> > We are serving up large file downloads from a rails 3.0 application using
> > nginx via an X-Accel-Redirect header. This worked splendidly up until
> > recently when we switched over to serving the application and downloads over
> > HTTPS.
> > 
> > Apparently Internet Explorer doesn't like downloading files over SSL when
> > the Cache-Control header is set to "no-cache" as it can't handle it
> > internally.
> > 
> > Unfortunately, we can't figure out how to set the Cache-Control header as
> > everything we've tried doesn't change it from "no-cache".
> > 
> > We've tried the proxy_hide_header Cache-Control; declaration in nginx. We've
> > tried using add_header Cache-Control "private"; in nginx too, without any
> > luck. In the rails application we are serving the file as follows:
> > 
> > head(:x_accel_redirect =>
> > "/file_redirect/#{INTERNAL_MEDIA_HOST}/#{filepath}", :content_type => mime,
> > :content_length => size, :content_disposition => "attachment;
> > filename=\"filename.mp4"")
> > 
> > So before that we've tried adding:
> > 
> > response.headers.delete("Pragma")
> > response.headers.delete('Cache-Control')
> > 
> > and also
> > 
> > response.headers["Cache-Control"] = "public"
> > response.headers["Pragma"] = ""
> > response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT"
> > 
> > In the case of the last one, the Expires header does get set, but
> > Cache-Control stays as "no-cache".
> > 
> > Does anyone have any suggestions as to what might be causing this and how we
> > could set our own Cache-Control header?
> > 
> > 
> > 
> > Thanks,
> > Rory
> > 
> > 
> > _______________________________________________
> > Chat mailing list
> > Chat at lists.lrug.org (mailto:Chat at lists.lrug.org)
> > http://lists.lrug.org/listinfo.cgi/chat-lrug.org
> > 
> 
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org (mailto:Chat at lists.lrug.org)
> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
> 
> 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20120322/26d18073/attachment-0003.html>


More information about the Chat mailing list