Skip to content

Instantly share code, notes, and snippets.

@rafaelss
Forked from rmanalan/.gems
Created May 20, 2010 22:18
Show Gist options
  • Save rafaelss/408193 to your computer and use it in GitHub Desktop.
Save rafaelss/408193 to your computer and use it in GitHub Desktop.
rack static site
# Static site using Rack (with expire headers and etag support)... great for hosting static sites on Heroku
require "bundler/setup"
require 'rack/contrib'
require 'rack-rewrite'
use Rack::StaticCache, :urls => ['/images','/css','/favicon.ico'], :root => "public"
use Rack::ETag
use Rack::Rewrite do
rewrite '/', '/index.html'
end
run Rack::Directory.new('public')
source "http://rubygems.org"
gem 'rack-contrib', :git => 'git://github.com/rack/rack-contrib.git'
gem 'rack-rewrite'
@wprater
Copy link

wprater commented Aug 25, 2010

This does not seem to work on Heroku with bundler (1.0.0.rc.5). Have you been able to test it? Also can you comment on what line #3 is supposed to include?

Thanks!

@rafaelss
Copy link
Author

This code is supposed to work under an older version of bundler.
I just updated it to work with latest stable bundler.

@wprater
Copy link

wprater commented Aug 25, 2010

Works great. Thanks!

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