开发者

rails send_file with nginx

开发者 https://www.devze.com 2023-02-03 15:12 出处:网络
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...

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号