Hi Everyone,
I research about VCL ratelimit.check_rate: ratelimit.check_rate | Fastly Documentation
I configured with VCL below:
INIT
penaltybox pbox { }
ratecounter rc { }
RECV
declare local var.entry STRING;
set var.entry = req.http.Fastly-Client-IP;
if (req.http.host == "ABC..com" && req.url.qs ~ "^(cat=|price=)") {
if (fastly.ff.visits_this_service == 0 && ratelimit.check_rate(var.entry, rc, **10, 10, 20**, pbox, 2m)) {
error 601;
log "hit condition";
}
}
I ran some tests with JMeter and realized
- When I sent more than 20 requests / 10 seconds will banned by Fasly with an error is 429.
But when I change Config VCL below to 1,10,10 so It not banned by Fastly.
if (req.http.host == "ABC..com" && req.url.qs ~ "^(cat=|price=)") {
if (fastly.ff.visits_this_service == 0 && ratelimit.check_rate(var.entry, rc, **1, 10, 20**, pbox, 2m)) {
error 601;
log "hit condition";
}
}
I have two questions about VCL above:
- Why do we have to configure it delta as 10 and not 1 so that when we request more than 20 requests it will be banned?
- Can you explain clearly and give me an easy example to understand delta, and RC? I don’t know why we must set the delta is 10.
Thanks community.