remap (Rack::URLMap)

    # File lib/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)| [h ? -h.size : (-1.0 / 0.0), -l.size] }  # Longest path first
        end