Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Rack middleware for request rewriting

tag: v0.0.1

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 README.rdoc
Octocat-spinner-32 Rakefile
Octocat-spinner-32 VERSION.yml
Octocat-spinner-32 rack-rewrite.gemspec
README.rdoc

rack-rewrite

Rack middleware for request rewriting.

Example

use Rack::Rewrite do

  on :method => 'get' do

    on :uri => %r{/(api|test)} do
      act { puts "hey way to go!" }
      pass
    end

    on :uri => %r{/google.*} do
      redirect { "http://google.com/search?q=#{CGI.escape(query_string)}" }
    end

    on :uri => %r{/valid_place.*} do
      pass
    end

    fail
  end

end
Something went wrong with that request. Please try again.