Skip to content

Instantly share code, notes, and snippets.

@lgs
Forked from yrgoldteeth/heroku_static.rb
Created January 29, 2011 22:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lgs/802263 to your computer and use it in GitHub Desktop.
Save lgs/802263 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'sinatra'
set :public, Proc.new { File.join(root, "_site") }
# This before filter ensures that your pages are only ever served
# once (per deploy) by Sinatra, and then by Varnish after that
before do
response.headers['Cache-Control'] = 'public, max-age=31557600' # 1 year
end
get '/' do
File.read('_site/index.html')
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment