Skip to content

Commit

Permalink
Always redirect to timelessrepo.com in production
Browse files Browse the repository at this point in the history
  • Loading branch information
judofyr committed Feb 28, 2011
1 parent d0c3468 commit d94d720
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion config.ru
@@ -1,6 +1,27 @@
require 'timeless'

if ENV['RACK_ENV'] != "production"
class RedirectToProperDomain
def initialize(app, domain)
@app = app
@domain = domain
@cache = {}
end

def call(env)
if @domain == env['HTTP_HOST']
@app.call(env)
else
[301, {
'Location' => "http://#{@domain}#{env['PATH_INFO']}",
'Content-Type' => "text/html"
}, []]
end
end
end

if ENV['RACK_ENV'] == "production"
use RedirectToProperDomain, 'timelessrepo.com'
else
require 'new_relic/rack/developer_mode'
use NewRelic::Rack::DeveloperMode
end
Expand Down

0 comments on commit d94d720

Please sign in to comment.