You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

22 lines
681 B

require 'rubygems'
require 'rack'
require 'rack/contrib'
require 'rack/trystatic'
require 'mime/types'
use Rack::Deflater
use Rack::ETag
$rootdir="site"
use Rack::TryStatic,
:root => $rootdir, # static files root dir
:urls => %w[/], # match all requests
:try => ['.html', 'index.html', '/index.html'] # try these postfixes sequentially
errorFile='site/404.html'
run lambda { [404, {
"Last-Modified" => File.mtime(errorFile).httpdate,
"Content-Type" => "text/html",
"Content-Length" => File.size(errorFile).to_s
}, File.read(errorFile)] }