    # File lib/action_controller/vendor/rack-1.0/rack/urlmap.rb, line 19
        def remap(map)
          @mapping = map.map { |location, app|
            if location =~ %r{\Ahttps?://(.*?)(/.*)}
              host, location = $1, $2
            else
              host = nil
            end

            unless location[0] == ?/
              raise ArgumentError, "paths need to start with /"
            end
            location = location.chomp('/')

            [host, location, app]
          }.sort_by { |(h, l, a)| [-l.size, h.to_s.size] }  # Longest path first
        end