Hello Corin,

On 2022-06-20 13:18, Corin Langosch wrote:
Hi guys,

 I'm using haproxy 2.5 and have some basic rate limiting configured
like this (the actual configuration contains more rules for different
urls):

     backend test
      acl rate_limit_by_ip_exceeds_limit
src,table_http_req_rate(rate_limit_by_ip) gt 100
      http-request deny deny_status 429 if
rate_limit_by_ip_exceeds_limit
      http-request track-sc0 src table rate_limit_by_ip
      ...

    backend rate_limit_by_ip
      stick-table type ipv6 size 1m expire 24h store http_req_rate(5m)


 Is there any way to include a "retry-after" header in case the rate
limit is exceeded?


You can with an http-after-response rule. See https://cbonte.github.io/haproxy-dconv/2.5/configuration.html#http-after-response Or you can use an http-request return rule instead of deny/deny_status to set the status code and header with the same rule.
https://cbonte.github.io/haproxy-dconv/2.5/configuration.html#http-request%20return

--
Jérôme



Reply via email to