[Mongrel] X-Sendfile doesn't work
bruno.celeste at gmail.com
Thu Jan 25 06:38:03 EST 2007
I try to use the "X-Sendfile" header, but it doesn't work as expected.
In my controller:
path = "/home/bruno/file.tar.gz"
headers['X-Sendfile'] = path
headers['Content-Type'] = "application/octet-stream"
headers['Content-Length'] = File.size(path)
render :nothing => true
When I request the file, nothing is shown, just a white page. If I do
a HEAD request:
HTTP/1.1 200 OK
Date: Thu, 25 Jan 2007 11:22:19 GMT
Status: 200 OK
Server: Mongrel 1.0.1
Content-Type: application/force-download; charset=utf-8
The weird thing is the content-length is bad and I think mongrel
should not show the X-Sendfile header. I also tried to add the
content-disposition header but didn't resolve the problem.
I'm using edge rails and the latest mongrel (I deleted older mongrels)
More information about the Mongrel-users