Hi The "http-response redirect location" action not work will because of the received response contents from the server have no truncate. the attach patches should fix that.
0001-BUG-MEDIUM-http-res-redir-not-work-coz-exist-res-con.patch base on version 2.0.12 0001-BUG-MEDIUM-htx-res-redir-not-work-coz-exist-res-cont.patch base on master Best regards.
From 19f913c163b4acfa5b0e05afb5079a9c1d38f97a Mon Sep 17 00:00:00 2001 From: Kevin Zhu <[email protected]> Date: Tue, 24 Dec 2019 16:39:42 +0800 Subject: [PATCH] BUG/MEDIUM: htx: res redir not work coz exist res contents not truncate --- src/http_ana.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/http_ana.c b/src/http_ana.c index ee00d2c..7e7d711 100644 --- a/src/http_ana.c +++ b/src/http_ana.c @@ -2526,6 +2526,8 @@ int http_apply_redirect_rule(struct redirect_rule *rule, struct stream *s, struc close = 1; htx = htx_from_buf(&res->buf); + channel_htx_truncate(res, htx); + b_set_data(&res->buf, b_size(&res->buf)); flags = (HTX_SL_F_IS_RESP|HTX_SL_F_VER_11|HTX_SL_F_XFER_LEN|HTX_SL_F_BODYLESS); sl = htx_add_stline(htx, HTX_BLK_RES_SL, flags, ist("HTTP/1.1"), status, reason); if (!sl) -- 2.7.4
From 894b21265a24efd764c2d34a1664e843d472ea6a Mon Sep 17 00:00:00 2001 From: Kevin Zhu <[email protected]> Date: Tue, 24 Dec 2019 16:34:36 +0800 Subject: [PATCH] BUG/MEDIUM: http: res redir not work coz exist res contents not truncate --- src/proto_http.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/proto_http.c b/src/proto_http.c index 3c16776..628f1b2 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -2468,6 +2468,8 @@ int http_apply_redirect_rule(struct redirect_rule *rule, struct stream *s, struc memcpy(chunk->area + chunk->data, "\r\n\r\n", 4); chunk->data += 4; FLT_STRM_CB(s, flt_http_reply(s, txn->status, chunk)); + /* Trim any possible response */ + b_set_data(&res->chn->buf, co_data(res->chn)); co_inject(res->chn, chunk->area, chunk->data); /* "eat" the request */ b_del(&req->chn->buf, req->sov); @@ -2477,8 +2479,6 @@ int http_apply_redirect_rule(struct redirect_rule *rule, struct stream *s, struc s->res.analysers = AN_RES_HTTP_XFER_BODY | (s->res.analysers & AN_RES_FLT_END); req->msg_state = HTTP_MSG_CLOSED; res->msg_state = HTTP_MSG_DONE; - /* Trim any possible response */ - b_set_data(&res->chn->buf, co_data(res->chn)); res->next = res->sov = 0; /* let the server side turn to SI_ST_CLO */ channel_shutw_now(req->chn); -- 2.7.4

