function setURLHost(url, host) {
    const urlParsed = new URL(url);
    urlParsed.hostname = host;
    return urlParsed.toString();
}
Set URL host.

@param url - Source URL string
@param host - New host string
@returns An updated URL string