Skip to content

Instantly share code, notes, and snippets.

@toolmantim
Created May 18, 2010 11:25
Show Gist options
  • Save toolmantim/404888 to your computer and use it in GitHub Desktop.
Save toolmantim/404888 to your computer and use it in GitHub Desktop.
# Rackup file for serving up a static site from a "public" directory
#
# Useful for chucking a static site on Heroku
class IndexRewriter
def initialize(app) @app = app end
def call(env)
env["PATH_INFO"].gsub! /\/$/, '/index.html'
@app.call(env)
end
end
use IndexRewriter
run Rack::File.new("public")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment