Hi,

On Tue, 2022-11-22 at 20:57 +0000, Branitsky, Norman wrote:
> I have the following "generic" rate limit defined - 150 requests in 10s
> from the same IP address:
>     stick-table  type ip size 100k expire 30s store http_req_rate(10s)
>     http-request track-sc0 src unless { src -f
> /etc/CONFIG/haproxy/cidr.lst }
>     http-request deny deny_status 429 if { sc_http_req_rate(0) gt 150 }
>  
> Is it possible to rate limit a specific "computationally expensive" HTML
> request from the same IP address to a much smaller number?

Untested, but try using sc1 for the search url:
http-request track-sc1 src table search_table if
acl_matching_datamart_searchbyname !acl_exclude_cidr_lst

http-request deny deny_status 429 if { sc1_http_req_cnt(search_table) gt 5 }

backend search_table
    stick-table type ... store http_req_cnt,http_req_rate...

-Jarno

-- 
Jarno Huuskonen

Reply via email to