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.

Revisions

  1. toolmantim revised this gist May 18, 2010. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion config.ru
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@
    class IndexRewriter
    def initialize(app) @app = app end
    def call(env)
    env["PATH_INFO"] = "/index.html" if env["PATH_INFO"] == "/"
    env["PATH_INFO"].gsub! /\/$/, '/index.html'
    @app.call(env)
    end
    end
  2. toolmantim created this gist May 18, 2010.
    15 changes: 15 additions & 0 deletions config.ru
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    # 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"] = "/index.html" if env["PATH_INFO"] == "/"
    @app.call(env)
    end
    end

    use IndexRewriter

    run Rack::File.new("public")