require "uri"
url = "http://foo.example.com:8080/foo/bar?x=y"
baseurl = URI.join(url, "/").to_s
# http://foo.example.com:8080/Mar 13, 2026
require "uri"
url = "http://foo.example.com:8080/foo/bar?x=y"
baseurl = URI.join(url, "/").to_s
# http://foo.example.com:8080/