github.com/adamar/terraform@v0.2.2-0.20141016210445-2e703afdad0e/website/config.ru (about)

     1  require "rack"
     2  require "rack/contrib/not_found"
     3  require "rack/contrib/response_headers"
     4  require "rack/contrib/static_cache"
     5  require "rack/contrib/try_static"
     6  
     7  # Properly compress the output if the client can handle it.
     8  use Rack::Deflater
     9  
    10  # Set the "forever expire" cache headers for these static assets. Since
    11  # we hash the contents of the assets to determine filenames, this is safe
    12  # to do.
    13  use Rack::StaticCache,
    14    :root => "build",
    15    :urls => ["/images", "/javascripts", "/stylesheets"],
    16    :duration => 2,
    17    :versioning => false
    18  
    19  # Try to find a static file that matches our request, since Middleman
    20  # statically generates everything.
    21  use Rack::TryStatic,
    22    :root => "build",
    23    :urls => ["/"],
    24    :try  => [".html", "index.html", "/index.html"]
    25  
    26  # 404 if we reached this point. Sad times.
    27  run Rack::NotFound.new(File.expand_path("../build/404.html", __FILE__))