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