Skip to content

Instantly share code, notes, and snippets.

@dlackty
Created April 16, 2013 11:05
Show Gist options
  • Save dlackty/5395095 to your computer and use it in GitHub Desktop.
Save dlackty/5395095 to your computer and use it in GitHub Desktop.
HTTP simple redirection as heroku app.
# This example allows requests for example.com and localhost.
# If any other domain is requested it redirects to the first domain on the
# list - example.com preserving path and query string from the first request.
require "rack/domain_redirect"
# This is how you use and configure Rack::DomainRedirect middleware
use Rack::DomainRedirect, ['icook.tw']
run lambda { |env| [200, {'Content-Type' => 'text/plain'}, ['Hello World!']] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment