Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
22 lines (12 sloc) 543 Bytes


Directs all traffic to a single domain via 301 redirects.

Example Usage (Heroku)

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


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

Heroku Config

heroku config:add DOMAIN=""

Now all requests to (or anything else pointed at the app) will 301 to

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

You can also give provide a port along with your domain "".

Jump to Line
Something went wrong with that request. Please try again.