From: Olivier Houchard Date: Thu, 26 Nov 2026 17:51:47 +0000 (+0100) Subject: BUG/MEDIUM: backend: only start the mux early when 0-RTT may be used X-Git-Url: https://git.kaiwu.me/http/%22../$%7BGITURL%7D/static/%7B@url%7D?a=commitdiff_plain;h=4810d943fe40dc995cfb7a1ea3d22591b8fdafb5;p=haproxy.git BUG/MEDIUM: backend: only start the mux early when 0-RTT may be used Since commit d4c51a4f5 ("MEDIUM: server: Make use of the stored ALPN stored in the server"), the mux is installed before the handshake, from the cached ALPN, for every SSL server with an ALPN, while this is only needed to send early data. If the handshake then negotiates another protocol, the wrong mux stays in place and the request ends in a 502. Let's only do it for servers with "allow-0rtt". This should help with github issue #3473, and must be backported to 3.3. --- diff --git a/src/backend.c b/src/backend.c index 140922c05..4232be31e 100644 --- a/src/backend.c +++ b/src/backend.c @@ -2080,10 +2080,14 @@ int connect_server(struct stream *s) */ if (IS_HTX_STRM(s) && srv->use_ssl && (srv->ssl_ctx.alpn_str || srv->ssl_ctx.npn_str)) { - HA_RWLOCK_RDLOCK(SERVER_LOCK, &srv->path_params.param_lock); - if (srv->path_params.srv_hash != hash || srv->path_params.nego_alpn[0] == 0) + if (!(srv->ssl_ctx.options & SRV_SSL_O_EARLY_DATA)) may_start_mux_now = 0; - HA_RWLOCK_RDUNLOCK(SERVER_LOCK, &srv->path_params.param_lock); + else { + HA_RWLOCK_RDLOCK(SERVER_LOCK, &srv->path_params.param_lock); + if (srv->path_params.srv_hash != hash || srv->path_params.nego_alpn[0] == 0) + may_start_mux_now = 0; + HA_RWLOCK_RDUNLOCK(SERVER_LOCK, &srv->path_params.param_lock); + } } #endif /* TLSEXT_TYPE_application_layer_protocol_negotiation */