Skip to content

Instantly share code, notes, and snippets.

@jasoncodes
Forked from toolmantim/config.ru
Created May 18, 2010 11:29
Show Gist options
  • Save jasoncodes/404891 to your computer and use it in GitHub Desktop.
Save jasoncodes/404891 to your computer and use it in GitHub Desktop.
Serving simple static sites using Rack
# 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")
@toolmantim
Copy link

nice! Updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment