Fix ratelimit headers disappear

This is a follow up MR from !262 (comment 484061672) to fix the issue that RateLimit-* headers disappear for 200 requests. The root cause of this issue is the lazy evaluation of acl check acl no_ratelimit_headers res.hdr(RateLimit-Limit) -m len 0. If any statement sets RateLimit-Limit header, the following statements will re-evaluate instead of using the value from the backend's response. The fix is to reorder the checks to push RateLimit-Limit check to the bottom.

This is the test on my local environment.

When the backend returns 200. HAProxy inserts its hard limit:

Screenshot_from_2021-01-13_11-21-27

When the backend returns 429. HAProxy uses backend's headers instead: Screenshot_from_2021-01-13_11-21-40

Merge request reports

Loading