diff --git a/xpra/net/websockets/handler.py b/xpra/net/websockets/handler.py index 012a1ec9e2..2dd95bdaa3 100644 --- a/xpra/net/websockets/handler.py +++ b/xpra/net/websockets/handler.py @@ -115,9 +115,14 @@ def do_redirect_https(self) -> None: log.warn("Warning: cannot redirect to https without a 'Host' header") self.send_error(400, "Client did not send a 'Host' header") return - if not is_valid_hostname(server_address): + parts = server_address.split(":") + if len(parts) == 2: + host = parts[0] + else: + host = server_address + if not is_valid_hostname(host): log.warn("Warning: cannot redirect to https using an invalid hostname") - log.warn(f" {server_address!r}") + log.warn(f" {host!r}") self.send_error(400, "Client specified an invalid 'Host' header") return self.write_byte_strings(