open-consul/website/config.ru
Seth Vargo affdf4548a Redirect old WebUI downloads page to new one
There are currently a number of sites on the Internet that link to the old
downloads_web_ui.html page, including some popular blog posts. Since the WebUI
has been moved onto the Consul page itself, these links are now broken.

This commit adds a 301 (to preserve SEO) redirect from the old page to the new
one.
2014-10-26 22:21:45 -04:00

33 lines
933 B
Ruby

require "rack"
require "rack/contrib/not_found"
require "rack/contrib/response_headers"
require "rack/contrib/static_cache"
require "rack/contrib/try_static"
require "rake/rewrite"
use Rack::Rewrite do
r301 "/downloads_web_ui.html", "/downloads.html"
end
# Properly compress the output if the client can handle it.
use Rack::Deflater
# Set the "forever expire" cache headers for these static assets. Since
# we hash the contents of the assets to determine filenames, this is safe
# to do.
use Rack::StaticCache,
:root => "build",
:urls => ["/assets"],
:duration => 2,
:versioning => false
# Try to find a static file that matches our request, since Middleman
# statically generates everything.
use Rack::TryStatic,
:root => "build",
:urls => ["/"],
:try => [".html", "index.html", "/index.html"]
# 404 if we reached this point. Sad times.
run Rack::NotFound.new(File.expand_path("../build/404.html", __FILE__))