我已经设置了一个路径来处理特定的文件下载。Rails 3.0.x send_file发送404 HTML而不是真实文件
match '/overview' => "pages#overview", :as => "da_overview"
在页面#概述
,我与这条线
send_file File.join(Rails.root, 'public', 'downloads', 'overview.pdf'), :type =>"application/pdf"
我在x sendfile的设置切换发送文件。
config.action_dispatch.x_sendfile_header = "X-Sendfile"
另外,我已经在apache服务器上安装并启用了mod_xsendfile模块。我也为我的网站启用了它。
XSendFile on
不过,当我打的网址http://mysite.com/overview,浏览器下载overview.pdf.html
和HTML文件说404: Requested URL /overview not found on this server
我检查文件是否存在。 pdf文件是/ public/downloads目录。我缺少什么配置?请帮忙。