diff --git a/src/cfgparse.c b/src/cfgparse.c index 0cffdbbf4a..2682fba333 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -3207,10 +3207,6 @@ int check_config_validity() if (!LIST_ISEMPTY(&curproxy->filter_configs)) { curproxy->fe_req_ana |= AN_REQ_FLT_START_FE | AN_REQ_FLT_XFER_DATA | AN_REQ_FLT_END; curproxy->fe_rsp_ana |= AN_RES_FLT_START_FE | AN_RES_FLT_XFER_DATA | AN_RES_FLT_END; - if (curproxy->mode == PR_MODE_HTTP) { - curproxy->fe_req_ana |= AN_REQ_FLT_HTTP_HDRS; - curproxy->fe_rsp_ana |= AN_RES_FLT_HTTP_HDRS; - } } } @@ -3237,10 +3233,6 @@ int check_config_validity() if (!LIST_ISEMPTY(&curproxy->filter_configs)) { curproxy->be_req_ana |= AN_REQ_FLT_START_BE | AN_REQ_FLT_XFER_DATA | AN_REQ_FLT_END; curproxy->be_rsp_ana |= AN_RES_FLT_START_BE | AN_RES_FLT_XFER_DATA | AN_RES_FLT_END; - if (curproxy->mode == PR_MODE_HTTP) { - curproxy->be_req_ana |= AN_REQ_FLT_HTTP_HDRS; - curproxy->be_rsp_ana |= AN_RES_FLT_HTTP_HDRS; - } } } diff --git a/src/http_ana.c b/src/http_ana.c index a13c946826..b0067c307a 100644 --- a/src/http_ana.c +++ b/src/http_ana.c @@ -452,6 +452,9 @@ int http_process_req_common(struct stream *s, struct channel *req, int an_bit, s if (!(s->flags & SF_FINST_MASK)) s->flags |= SF_FINST_R; + 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_FLT_HTTP_HDRS | AN_REQ_FLT_END); req->analysers &= ~AN_REQ_FLT_XFER_DATA; @@ -777,6 +780,12 @@ int http_process_request(struct stream *s, struct channel *req, int an_bit) } } + /* Filter the request headers if there are filters attached to the + * stream. + */ + if (HAS_FILTERS(s)) + req->analysers |= AN_REQ_FLT_HTTP_HDRS; + /* If we have no server assigned yet and we're balancing on url_param * with a POST request, we may be interested in checking the body for * that parameter. This will be done in another analyser. @@ -2071,6 +2080,12 @@ int http_process_res_common(struct stream *s, struct channel *rep, int an_bit, s if (!http_eval_after_res_rules(s)) goto return_int_err; + /* Filter the response headers if there are filters attached to the + * stream. + */ + if (HAS_FILTERS(s)) + rep->analysers |= AN_RES_FLT_HTTP_HDRS; + /* Always enter in the body analyzer */ rep->analysers &= ~AN_RES_FLT_XFER_DATA; rep->analysers |= AN_RES_HTTP_XFER_BODY; diff --git a/src/proxy.c b/src/proxy.c index 234515ddda..d044150c07 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -2153,11 +2153,6 @@ int stream_set_backend(struct stream *s, struct proxy *be) http_init_txn(s); } - /* Be sure to filter request headers if the backend is an HTTP proxy and - * if there are filters attached to the stream. */ - if (s->be->mode == PR_MODE_HTTP && HAS_FILTERS(s)) - s->req.analysers |= AN_REQ_FLT_HTTP_HDRS; - if (s->txn) { /* If we chain a TCP frontend to an HTX backend, we must upgrade * the client mux */ diff --git a/src/stream.c b/src/stream.c index c1ba9050d9..eb64807743 100644 --- a/src/stream.c +++ b/src/stream.c @@ -933,11 +933,6 @@ static void back_establish(struct stream *s) rep->analysers |= strm_fe(s)->fe_rsp_ana | s->be->be_rsp_ana; - /* Be sure to filter response headers if the backend is an HTTP proxy - * and if there are filters attached to the stream. */ - if (IS_HTX_STRM(s) && HAS_FILTERS(s)) - rep->analysers |= AN_RES_FLT_HTTP_HDRS; - si_rx_endp_more(si); rep->flags |= CF_READ_ATTACHED; /* producer is now attached */ if (objt_cs(si->end)) {