]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MEDIUM: http-ana: restore the purge of backend analyzers on applets
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 19 Nov 2026 09:30:00 +0000 (10:30 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 19 Nov 2026 13:28:58 +0000 (14:28 +0100)
Commit 7568a0555 ("BUG/MINOR: http-ana: fix response compression for
applets") introduced a regression. It removed the purge of the request
analyzers performed when a request was intercepted by an applet, to only set
AN_REQ_HTTP_INNER. The idea was that http_process_request() called on
AN_REQ_HTTP_INNER configures all the analyzers needed to handle keep-alive
and compression on the HTTP response.

But doing so, some analyzers that were removed before the commit above,
remain attached. One of them, AN_REQ_SWITCHING_RULES, is responsible to set
a backend and all backend analyzers with it. So an request intercepted by an
applet in the frontend is still branched to a backend with its analyzers
armed. And they are evaluated against the intercepted request, as if it was
forwarded to the backend. Thus the http-request rules of the unassigned
backend are applied to the applet request. For instance, with a
"http-request deny" rule in the backend, a request intercepted by the
frontend stats applet is denied with a 403.

So the purge of the backend analyzers is restored, to only keep the
minimally required analyzers to handle keep-alive and compression on the
HTTP response. But, unlike the antique code from 1.5-dev24, the inner
processing is preserved: AN_REQ_HTTP_INNER is not removed by the purge
because it is needed to enable compression of the applet response when the
applet is branched from a backend.

No backport is needed.

src/http_ana.c

index 01a59753bcc0554ace25baa5255c581cd27e869c..0eb4721b6409af6c42cf31aedfee642e502b85e1 100644 (file)
@@ -503,6 +503,15 @@ int http_process_req_common(struct stream *s, struct channel *req, int an_bit, s
                        s->flags |= SF_ERR_LOCAL;   // to mark that it comes from the proxy
                http_set_term_flags(s);
 
+               if (HAS_FILTERS(s))
+                       req->analysers |= AN_REQ_FLT_HTTP_HDRS;
+
+               /* enable the minimally required analyzers to handle keep-alive and compression on the HTTP response */
+               req->analysers &= AN_REQ_HTTP_BODY | AN_REQ_HTTP_INNER |
+                                AN_REQ_FLT_HTTP_HDRS | AN_REQ_FLT_END;
+               req->analysers &= ~AN_REQ_FLT_XFER_DATA;
+               req->analysers |= AN_REQ_HTTP_XFER_BODY;
+
                /* inner is usually set only during backend processing, and is
                 * also needed for applets branched from frontends in order to
                 * enable compression, cookie processing, unique-id generation,