# Rate Limit by URL

**URL:** <https://discourse.haproxy.org/t/rate-limit-by-url/7631>\
**Category:** Help!\
**Created:** [May 3, 2022, 7:24pm UTC](https://discourse.haproxy.org/t/rate-limit-by-url/7631 "2022-05-03T19:24:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![vanessa.mello](https://avatars.discourse-cdn.com/v4/letter/v/a9a28c/32.png) [@vanessa.mello](https://discourse.haproxy.org/u/vanessa.mello)\
**Post date:** [May 3, 2022, 7:24pm UTC](https://discourse.haproxy.org/t/rate-limit-by-url/7631/1 "2022-05-03T19:24:03Z")

</div>

Hi, I make this:

> **[HAProxy Rate Limiting: Four Examples - HAProxy Technologies](https://www.haproxy.com/blog/four-examples-of-haproxy-rate-limiting/#rate-limit-by-url)**
>
> In this blog post we will show four examples of HAProxy rate limiting to stop clients from making too many requests and promote fair usage of your services.

And it works, but I don’t want to rate limit the path (e.g. [vanessamello.com](http://vanessamello.com)\*\*/img\*\*)

I want to rate the entire URL.

I tried to change from:  
http-request set-var(req.rate\_limit) path,map\_beg(/etc/haproxy/rates.map,20)

to:  
http-request set-var(req.rate\_limit) map\_str(/etc/haproxy/rates.map,20)

But I have this output:

[ALERT] (243) : parsing [/etc/haproxy/haproxy.cfg:123] : error detected in frontend ‘www-h2-https’ while parsing ‘http-request set-var(req.rate\_limit)’ rule : unknown fetch method ‘map\_str’.  
[ALERT] (243) : Error(s) found in configuration file : /etc/haproxy/haproxy.cfg  
failed!

Please, do anybody have any tip?
