]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: http-rules: Always replace the response status on a return action
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 19 Feb 2021 10:41:01 +0000 (11:41 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 19 Feb 2021 17:03:59 +0000 (18:03 +0100)
When a HTTP return action is triggered, HAProxy is responsible to return the
response, based on the configured status code. On the request side, there is
no problem because there is no server response to replace. But on the
response side, we must take care to override the server response status
code, if any, to be sure to use the rigth status code to get the http reply
message.

In short, we must always set the configured status code of the HTTP return
action before returning the http reply to be sure to get the right reply,
the one base on the http return action status code and not a reply based on
the server response status code..

This patch should fix the issue #1139. It must be backported as far as 2.2.

src/http_act.c

index 5a51ca4315a35d63e0e4674ee3444ca9f2282947..73e43ff6343325f4c47d103772c50dcdecc67446 100644 (file)
@@ -2026,6 +2026,7 @@ static enum act_return http_action_return(struct act_rule *rule, struct proxy *p
 {
        struct channel *req = &s->req;
 
+       s->txn->status = rule->arg.http_reply->status;
        if (http_reply_message(s, rule->arg.http_reply) == -1)
                return ACT_RET_ERR;