【问题标题】:rails send_file with nginxrails send_file 与 nginx
【发布时间】:2011-06-05 09:53:21
【问题描述】:

我正在尝试在 rails 3 中通过 send_file 发送文件...该文件已找到并且似乎也已发送,但由于某种原因未收到...

此外,即使设置了 :disposition => 'inline',浏览器总是显示“下载框”...

在 nginx conf 中,sendfile 设置为 on...

【问题讨论】:

    标签: nginx ruby-on-rails-3 sendfile


    【解决方案1】:

    我遇到了同样的问题,我查看了响应标头,发现响应类型被设置为application/octet-stream。调用 send_file 时尝试设置文件的 mime 类型

    send_file file, :disposition => 'inline', :type => 'image/png'

    【讨论】:

      【解决方案2】:

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2015-03-16
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-01-05
        相关资源
        最近更新 更多