Rate Limiting Syntax in Traefik.toml

In the documentation, it says you can add rate limiting by adding something similar to the Traefik.toml config file:

[frontends]
[frontends.frontend1]
[frontends.frontend1.ratelimit]
extractorfunc = "client.ip"
[frontends.frontend1.ratelimit.rateset.rateset1]
period = "10s"
average = 10
burst = 20

But to me it's a bit unclear what frontend1 is. I've tried the putting service names from my docker-compose.yml but there was no mention of rate limiting in the Traefik container logs, and a looped curl with hundreds of iterations failed to trigger any HTTP 429 responses.

Does it have anything to do with the frontend names in the docker ui at /dashboard? However, for me everytime I call docker-compose up, the numbering is slightly different (a frontend labeled 2 could be 3 the next time etc).

Hello @ratchet5000,

If you are using the docker provider to provide configuration to traefik, you may want to use the ratelimiting labels on those containers to provide rate limiting (such as traefik.frontend.rateLimit.extractorFunc):

https://docs.traefik.io/v1.7/configuration/backends/docker/#on-containers

You probably don't want to use the File provider to accomplish this, as the file provider is not as dynamic as the docker provider is.

I still run into the same problem of ambiguity for labels like traefik.frontend.rateLimit.rateSet. < name > .period=6

What do I put for < name >? Do I need to set a container name in the yml config file?

Give it a unique name, like baconlover or defaultlimit.

Because you can define multiple rate sets per container, you have the ability to give the sets names. What you name them is up to you.

1 Like

Thanks, that worked great