HTTP retry using haproxy


#1

Hello,

we have some configuration to use http retry in varnish:

  • vcl_backend_response
# retry requests before giving up
 if (bereq.http.host ~ "^(api|push) && bereq.url ~ "^/v1/(send|soap).*" &&
      (beresp.status == 500 || beresp.status == 502 || beresp.status == 503) &&
      bereq.retries < 3
  ) {
    std.log("[" + now + "] HTTP " + beresp.status + " on " + bereq.url + ". Retrying (" + bereq.retries + ").");
    return (retry);
  }

how can I do some like this using haproxy?

Thanks!!


#2

Haproxy only retries on connection failure, it cannot retry based on specific response codes.