Rack::ForceDomain

Added by cwninja at May 17, 2010 15:02 Star_smallStar_smallStar_smallStar_smallStar_small_half
GitHub stats:
Magnifier watcher(s)
Arrow_branch fork(s)
Wrench

About

Rack::ForceDomain: Force all visitors onto a single domain.

Details

Directs all traffic to a single domain via 301 redirects.

Usage

Example Usage (Heroku)

config.ru

use Rack::ForceDomain, ENV["DOMAIN"]

environment.rb

config.middleware.use Rack::ForceDomain, ENV["DOMAIN"]

Heroku Config

heroku config add DOMAIN="foo.com"

Now all requests to www.foo.com (or anything else pointed at the app) will 301 to foo.com.

If the $DOMAIN environment variable is missing, no redirection will occur.

blog comments powered by Disqus