Skip to content

Instantly share code, notes, and snippets.

@alandipert
Created January 5, 2012 18:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alandipert/1566556 to your computer and use it in GitHub Desktop.
Save alandipert/1566556 to your computer and use it in GitHub Desktop.
Deploy static sites to heroku and use heroku caching
use Rack::Static,
:urls => ['/css', '/images'], # put directories here, files will get served for free
:root => "public"
run lambda { |env|
[
200,
{ 'Content-Type' => 'text/html', 'Cache-Control' => 'public, max-age=86400' },
File.open('public/index.html', File::RDONLY) # Point this at the starting file
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment