0.0
No commit activity in last 3 years
No release in over 3 years
A gem that provides a simple example of rewrites in rack
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0
 Project Readme

rack-redirect

More and more of my friends are deploying on Engine Yard Solo and I keep getting asked for help. My friends at everlater wanted every incoming request for *.everlater.com to go to www.everlater.com. Here's a little app that you can deploy on solo to handle all the weird HTTP_HOST variants your app might 404 on.

Installation

% sudo gem install rack-redirect

Deployment

Your rackup file should look something like this.

require 'rubygems'
require File.join(File.dirname(__FILE__), 'lib', 'rack-redirect')

use Rack::EY::Solo::DomainRedirect
run lambda { |env| [200, { 'Content-Type' => 'text/plain' }, ['Hello there, gorgeous'] ] }

testing

Just run rake... rack-redirect with a value of 'www' - forwards on from http://www.example.org to the next app - redirects from http://example.org to http://www.example.org/ - redirects from http://wwww.example.org to http://www.example.org/ - redirects from http://alpha.example.com to http://www.example.org/ - redirects from http://example.org/nate to http://www.example.org/nate - redirects from http://example.org/nate?trip_id=42 to http://www.example.org/nate?trip_id=42

rack-redirect without specifying a prefix
  - forwards on requests from http://example.org to the next app
  - redirects from http://alpha.example.com to http://example.org/
  - redirects from http://alpha.example.org/nate to http://example.org/nate
  - redirects from http://alpha.example.org/nate?trip_id=42 to http://example.org/nate?trip_id=42