From 9136341bdae68774ac182e3764a88b833fd37632 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 11 Mar 2025 11:38:05 -0400 Subject: [PATCH] Tolerate different proxy pass configurations The stock reverse proxy configuration strips the leading '/confluent-api/' from the URL. However, when doing a custom reverse proxy set up, one may preserve full path without knowing which way to go. Since '/confluent-api/' will never be used inside the api, just strip it when detected to tolerate either of the likely proxy pass behaviors. --- confluent_server/confluent/httpapi.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/confluent_server/confluent/httpapi.py b/confluent_server/confluent/httpapi.py index 0b2abb4d..c47722d4 100644 --- a/confluent_server/confluent/httpapi.py +++ b/confluent_server/confluent/httpapi.py @@ -628,6 +628,8 @@ def wsock_handler(ws): def resourcehandler(env, start_response): + if env['PATH_INFO'].startswith('/confluent-api'): + env['PATH_INFO'] = env['PATH_INFO'].replace('/confluent-api', '') for hdr in env['headers_raw']: if hdr[0].lower().startswith('confluent'): hdrname = hdr[0].upper()