Changeset [5622] appears to have broken X-Sendfile, though I'm surprised this hasn't been reported already. I don't think I'm doing anything wrong. I have always used X-Sendfile like this, as I believe most people do.
response.headers["X-Sendfile"] = file
response.headers['Content-Length'] = File.size(file) rescue nil
render :nothing => true
The problem is that Content-Length now gets overridden by Rails using @body.size, which is 1 when using render :nothing => true. This new Rails code has since been moved in changeset [6165]. I haven't tried this version but it looks as though the problem remains. Changing self.headers[["Content-Length"]] = ... to self.headers[["Content-Length"]] ||= ... would probably do the trick though I have always wondered why the web server doesn't set Content-Length itself when using X-Sendfile anyway. lighttpd doesn't appear to, at least not in version 1.4.11. Maybe Apache does and that's why no one else has reported this yet?