【发布时间】:2013-06-15 20:53:13
【问题描述】:
我已按照 Heroku 指南使用 Ruby Rack (https://devcenter.heroku.com/articles/static-sites-ruby) 部署静态文件,但除了 index.html 之外,我无法访问 \public 中的任何 HTML 文件。也就是说,localhost:9292/test.html 仍然映射到index.html。 (我所有的样式和 js 文件都正确服务)。
下面是我的config.ru 文件。我知道出了什么问题,但不确定有效的解决方案?
use Rack::Static, :urls => ["/images", "/js", "/css"], :root => "public"
run lambda { |env| [
200,
{
'Content-Type' => 'text/html',
'Cache-Control' => 'public, max-age=86400'
},
File.open('public/index.html', File::RDONLY) ] }
【问题讨论】: