From d33c6be758c0794105835d6c4c5286d0fc3852f6 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 16 May 2019 14:36:39 -0400 Subject: [PATCH] Fix forwarder over custom https ports --- confluent_server/confluent/httpapi.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/confluent_server/confluent/httpapi.py b/confluent_server/confluent/httpapi.py index 2feac493..4aed9292 100644 --- a/confluent_server/confluent/httpapi.py +++ b/confluent_server/confluent/httpapi.py @@ -469,6 +469,10 @@ def resourcehandler_backend(env, start_response): funport = forwarder.get_port(targip, env['HTTP_X_FORWARDED_FOR'], authorized['sessionid']) host = env['HTTP_X_FORWARDED_HOST'] + if ']' in host: + host = host.split(']')[0] + ']' + elif ':' in host: + host = host.rsplit(':', 1)[0] url = 'https://{0}:{1}/'.format(host, funport) start_response('302', [('Location', url)]) yield 'Our princess is in another castle!'