From d80c607cb629ab437a570629e133f39709b88678 Mon Sep 17 00:00:00 2001 From: josedpedroso Date: Thu, 12 Jul 2018 20:21:08 +0100 Subject: [PATCH] Port no longer included in token when using --host-token --- websockify/websocketproxy.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/websockify/websocketproxy.py b/websockify/websocketproxy.py index b8e3d99..4ad4918 100644 --- a/websockify/websocketproxy.py +++ b/websockify/websocketproxy.py @@ -146,8 +146,15 @@ Traffic Legend: # in the form of token: host:port if self.host_token: + # Use hostname as token token = self.headers.get('Host') + # Remove port from hostname, as it'll always be the one where + # websockify listens (unless something between the client and + # websockify is redirecting traffic, but that's beside the point) + if token: + token = token.partition(':')[0] + else: # Extract the token parameter from url args = parse_qs(urlparse(self.path)[4]) # 4 is the query from url