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.
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,