From b629f2d7e1ee9060a4eab81093920d445434ccb2 Mon Sep 17 00:00:00 2001 From: Bartosz Wieczorek Date: Wed, 25 Jun 2025 19:33:42 +0200 Subject: [PATCH] Fix proxy for websockets --- PAM/ssh/include/rublon/websockets.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PAM/ssh/include/rublon/websockets.hpp b/PAM/ssh/include/rublon/websockets.hpp index 6d79364..cd25cae 100644 --- a/PAM/ssh/include/rublon/websockets.hpp +++ b/PAM/ssh/include/rublon/websockets.hpp @@ -78,9 +78,7 @@ class WebSocket { info.port = CONTEXT_PORT_NO_LISTEN; info.protocols = protocols; info.options = LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT; - - context = lws_create_context(&info); - + if(cfg.proxyEnabled && (cfg.proxyType == "http" || cfg.proxyType == "https")) { assert(cfg.proxyType.has_value()); assert(cfg.proxyHost.has_value()); @@ -100,6 +98,8 @@ class WebSocket { info.http_proxy_address = proxyUrl.c_str(); info.http_proxy_port = config.proxyPort.value_or(8080); } + + context = lws_create_context(&info); const std::string_view prefix = "https://"; if(urlv.substr(0, prefix.size()) == prefix)