AFAIK also those requests responded by HTTP status code 429 are counted against requests count.
Is there any delay between test #2 and #3? Mirek Svoboda | +1 (845) 584-1854 | Skype: xsvobo10 On 27 September 2016 at 17:48, Samrat Roy <[email protected]> wrote: > Hello Sir, > > I am trying to implement rate limiting feature using HAroxy. My > requirement is to do rate limiting using a custom header . I have created > the below config file. > > I have configured 40 request are allowed in 10 sec and anything above 40 > should give 429 error. > > But I am facing one problem while implementing this. My test scenario is > as follows : > > Sl No. Number of Request/ 10 sec Result > 1 30 All request passed > 2 45 40 request pass and 5 gave 429 error code > 3 60 All request gave 429 > 4 25 All request passed > > In the scenario number 3 my expectation is 40 request should pass and 20 > request should fail. But its failing all the requests. Remaining all > scenarios are working as expected.Am I missing something ? Please help . > > > Configuration : > > frontend localnodes > bind *:80 > mode http > default_backend nodes > acl document_request path_beg -i / > acl is_upload hdr_beg(CustomHeader) -i customKey > acl too_many_uploads_by_user sc0_gpc0_rate() gt 40 > acl mark_seen sc0_inc_gpc0 gt 0 > stick-table type string size 100k expire 1s store gpc0_rate(10s) > tcp-request content track-sc0 hdr(CustomHeader) if METH_GET or > METH_POST document_request is_upload > use_backend ease-up-y00 if mark_seen too_many_uploads_by_user > > backend nodes > mode http > balance roundrobin > option forwardfor > server srv1 127.0.0.1:8081 check > > backend ease-up-y00 > mode http > errorfile 503 /etc/haproxy/errors/429rate.http > > > > Thank you in Advance. > Samrat >

