def build_virtual_host(
url: Union[str, "URL", None], virtualhost: Optional[str], path: str
) -> str:
if (not url and not virtualhost) or virtualhost == "/":
return ""
elif virtualhost:
return virtualhost.replace("/", "", 1)
else:
return path.replace("/", "", 1)