Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Rack::ForceDomain: Force all visitors onto a single domain
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.gitignore
Gemfile
README.markdown
Rakefile
rack-force_domain.gemspec

README.markdown

Rack::ForceDomain

Directs all traffic to a single domain via 301 redirects.

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.

You can also give provide a port along with your domain "foo.com:3000".

Something went wrong with that request. Please try again.