class Falcon::Middleware::Redirect
def call(request)
Redirect the request if the authority matches a specific host.
def call(request) if host = lookup(request) if @endpoint.default_port? location = "#{@endpoint.scheme}://#{host.authority}#{request.path}" else location = "#{@endpoint.scheme}://#{host.authority}:#{@endpoint.port}#{request.path}" end Console.info(self, "Redirecting incoming request...", request: request, location: location) return Protocol::HTTP::Response[301, [["location", location]], []] else super end end