rails send_file with nginx
I am trying to send a file via send_file, in rails 3... The file is found and is seemingly sent too, but for some reason it is not received...
Also even though :disposition => 'inline' is set, the browser always shows a "download box"...
In nginx conf, sendfile is set to on...开发者_运维问答
I had the same problem, I looked at the response headers and saw the response type was being set as application/octet-stream
. Try setting the file's mime type when calling send_file
send_file file, :disposition => 'inline', :type => 'image/png'
I suggest you should go through this: Serving Large Files Through Nginx via Rails 2.3 Using x-sendfile
精彩评论