class Rack::ForwardRequest - rack-1.6.1 Documentation

# class Rack::ForwardRequest

Rack::ForwardRequest gets caught by Rack::Recursive and redirects the current request to the app at `url`.

    raise ForwardRequest.new("/not-found")

### Attributes

env[R]
url[R]

### Public Class Methods

new(url, env={}) click to toggle source
Calls superclass method

    # File lib/rack/recursive.rb, line 13
    def initialize(url, env={})
      @url = URI(url)
      @env = env

      @env[PATH_INFO] =         @url.path
      @env[QUERY_STRING] =      @url.query  if @url.query
      @env["HTTP_HOST"] =       @url.host   if @url.host
      @env["HTTP_PORT"] =       @url.port   if @url.port
      @env["rack.url_scheme"] = @url.scheme if @url.scheme

      super "forwarding to #{url}"
    end