diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index 4cf02a9f..19712af4 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -264,9 +264,10 @@ class HttpCli(object): self.is_https = ( self.headers.get("x-forwarded-proto", "").lower() == "https" or self.tls ) - self.host = self.headers.get("host") or "{}:{}".format( - *list(self.s.getsockname()[:2]) - ) + self.host = self.headers.get("host") + if not self.host: + zs = "{}:{}".format(*list(self.s.getsockname()[:2])) + self.host = zs[7:] if zs.startswith("::ffff:") else zs n = self.args.rproxy if n: