Haproxy: Return last error on L7 retries

Created on 9 Jan 2020  路  6Comments  路  Source: haproxy/haproxy

This is a followup of this https://discourse.haproxy.org/t/502-as-result-of-unsuccessful-retries/4651 question.

What should haproxy do differently? Which functionality do you think we should add?

Forward to a client the last server response if L7 retry is enable and request exceeds all retries. Right now haproxy return blank 502 in this situation.

What are you trying to do?

We are trying to adopt retries in our frontend proxy (for especially 50x) and our application react differently on different backed errors but haproxy return 502 if retry exceeds all attempts.

minor fixed bug

All 6 comments

I think this indeed makes sense. I don't know what it involves to do
it though but it's worth having a look at it.

@wtarreau, we should probably don't try to trigger an l7 retry at the stream-interface level when the maximum connection retries is reached, in si_cs_recv(). Something like that:

diff --git a/src/stream_interface.c b/src/stream_interface.c
index 1d84ca9ad..214b73858 100644
--- a/src/stream_interface.c
+++ b/src/stream_interface.c
@@ -1372,7 +1372,7 @@ int si_cs_recv(struct conn_stream *cs)
                        break;
                }

-               if (si->flags & SI_FL_L7_RETRY) {
+               if ((si->flags & SI_FL_L7_RETRY) && si->conn_retries) {
                        struct htx *htx;
                        struct htx_sl *sl;

I think it's the best approach, yes.

Ok, so I'll handle this issue. I update the labels because it is a bug not a feature.

It should be fixed in upstream now.

It was so quick! Thx @capflam @wtarreau !

Was this page helpful?
0 / 5 - 0 ratings