Skip to content

Instantly share code, notes, and snippets.

@czottmann
Created June 4, 2012 22:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save czottmann/15666dac3cf4b5b2f8c4 to your computer and use it in GitHub Desktop.
Save czottmann/15666dac3cf4b5b2f8c4 to your computer and use it in GitHub Desktop.
Serving a static site on Heroku. Assumes a `public/` folder in the same directory as these files are.
require 'rack/rewrite'
use Rack::Rewrite do
r301 %r{(.*)}, '$1/', :not => %r{\.|/$}
rewrite %r{(.*)/$}, '$1/index.html'
end
use Rack::Deflater
use Rack::Static, :urls => [/./], :root => "public", :index => "index.html"
run Proc
source :rubygems
gem "rack"
gem "rack-rewrite", "~> 1.2.1"
web: bundle exec rackup config.ru -p $PORT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment