Skip to content

Instantly share code, notes, and snippets.

@wynst
Created August 9, 2010 10:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wynst/515261 to your computer and use it in GitHub Desktop.
Save wynst/515261 to your computer and use it in GitHub Desktop.
require 'bundler'
Bundler.setup
require 'rack/rewrite'
app = Rack::Builder.new do
use Rack::Rewrite do
r301 '/google', 'http://google.com'
end
end
run app
source :gemcutter
gem "rack", ">= 1.2.1"
gem "rack-rewrite", ">= 1.0.0"
thin --rackup config.ru start
>> Thin web server (v1.2.7 codename No Hup)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:3000, CTRL+C to stop
!! Unexpected error while processing request: undefined method `to_a' for #<Rack::Rewrite:0x00000001b83598>
/home/willy/.rvm/gems/ruby-1.9.2-head/gems/thin-1.2.7/lib/thin/connection.rb:117:in `post_process': undefined method `first' for #<Rack::Rewrite:0x00000001b83598> (NoMethodError)
from /home/willy/.rvm/gems/ruby-1.9.2-head/gems/thin-1.2.7/lib/thin/connection.rb:57:in `process'
from /home/willy/.rvm/gems/ruby-1.9.2-head/gems/thin-1.2.7/lib/thin/connection.rb:42:in `receive_data'
from /home/willy/.rvm/gems/ruby-1.9.2-head/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
from /home/willy/.rvm/gems/ruby-1.9.2-head/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
from /home/willy/.rvm/gems/ruby-1.9.2-head/gems/thin-1.2.7/lib/thin/backends/base.rb:57:in `start'
from /home/willy/.rvm/gems/ruby-1.9.2-head/gems/thin-1.2.7/lib/thin/server.rb:156:in `start'
from /home/willy/.rvm/gems/ruby-1.9.2-head/gems/thin-1.2.7/lib/thin/controllers/controller.rb:80:in `start'
from /home/willy/.rvm/gems/ruby-1.9.2-head/gems/thin-1.2.7/lib/thin/runner.rb:177:in `run_command'
from /home/willy/.rvm/gems/ruby-1.9.2-head/gems/thin-1.2.7/lib/thin/runner.rb:143:in `run!'
from /home/willy/.rvm/gems/ruby-1.9.2-head/gems/thin-1.2.7/bin/thin:6:in `<top (required)>'
from /home/willy/.rvm/gems/ruby-1.9.2-head/bin/thin:19:in `load'
from /home/willy/.rvm/gems/ruby-1.9.2-head/bin/thin:19:in `<main>'
# config.ru
###########
require 'bundler'
Bundler.setup
require './app'
run Sinatra::Application
# app.rb
###########
require 'sinatra'
require 'rack/rewrite'
use Rack::Rewrite do
r301 '/google', 'http://google.com'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment