Skip to content

Instantly share code, notes, and snippets.

@jccovey
Forked from toolmantim/config.ru
Created July 9, 2010 02:34
Show Gist options
  • Save jccovey/468956 to your computer and use it in GitHub Desktop.
Save jccovey/468956 to your computer and use it in GitHub Desktop.
Rack::File, but serves directories, too
# 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