0

I just deployed a static page to Heroku as a static rack app. My config.ru:

use Rack::Static, 
  :urls => ["/stylesheets", "/images"],
  :root => "public",
  :index => "public/index.html"

run lambda { |env|
  [
    200, 
    {
      'Content-Type'  => 'text/html', 
      'Cache-Control' => 'public, max-age=86400' 
    },
    File.open('public/index.html', File::RDONLY)
  ]
}

Now I want to redirect all request to this static index.html file. Any ideas how to achieve this?

Linus
  • 2,799
  • 3
  • 29
  • 43
  • see http://stackoverflow.com/questions/2265036/how-to-serve-static-files-via-rack – ian Jan 09 '12 at 16:02

2 Answers2

1

It actually worked from the beginning. I just had to adjust the paths to my images and CSS files.

Linus
  • 2,799
  • 3
  • 29
  • 43
0

If you remove the call to "use" the middleware Rack::Static, all requests will render index.html. Although you probably have to write

File.open('public/index.html').read

instead of

File.open('public/index.html', File::RDONLY)
moritz
  • 25,477
  • 3
  • 41
  • 36