Skip to content

Instantly share code, notes, and snippets.

Created October 4, 2015 16:48
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 anonymous/25d5bd7a5642c5ae17cb to your computer and use it in GitHub Desktop.
Save anonymous/25d5bd7a5642c5ae17cb to your computer and use it in GitHub Desktop.
use Rack::Static,
:urls => ["/fonts", "/stylesheets"],
:root => "."
run lambda { |env|
file = env['REQUEST_PATH']
file = file[1..-1]
file = "index.html" if file.size == 0
file += '/index.html' if File.directory?(file)
[
200,
{
'Content-Type' => 'text/html',
'Cache-Control' => 'public, max-age=86400'
},
File.open(file, File::RDONLY)
]
# How do I map /foo to bar.merserver.com
# map '/foo' do
# do something...
# end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment