From 50de5c85d567454d2ea9339892dd00a8b4f46e29 Mon Sep 17 00:00:00 2001 From: Konstantin Haase Date: Fri, 14 Sep 2012 21:47:00 +0200 Subject: [PATCH] respond to any unknown requests with index.html --- Gemfile.lock | 2 +- config.ru | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 8e535c1a..17fcf701 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -39,7 +39,7 @@ GIT GIT remote: git://github.com/travis-ci/travis-core.git - revision: 7b0da75b0a1d4ffd385ffe488dcf1a621aa73905 + revision: 73679d7263ded28620dac7815e4aed253a8191d3 specs: travis-core (0.0.1) actionmailer (~> 3.2.3) diff --git a/config.ru b/config.ru index 8707c477..3d72bd0e 100644 --- a/config.ru +++ b/config.ru @@ -44,6 +44,10 @@ end use Rack::Deflater if deflate and deflate != '0' +app = proc do |env| + Rack::File.new(nil).tap { |f| f.path = 'public/index.html' }.serving(env) +end + if run_api and run_api != '0' map api_endpoint.gsub(/:\d+/, '') do run Travis::Api::App.new @@ -57,9 +61,8 @@ map client_endpoint do require 'rake-pipeline' require 'rake-pipeline/middleware' use Rake::Pipeline::Middleware, 'AssetFile' + run app else - use Rack::Static, urls: [""], root: 'public', index: 'index.html' + run Rack::Cascade.new([Rack::File.new('public'), app]) end - - run proc { |e| Rack::File.new(nil).tap { |f| f.path = 'public/index.html' }.serving(env) } end