TsgcWSRateLimiter › Properties › PerEndpoint
Collection of pattern-based rules matched by wildcard against the request key.
property PerEndpoint: TsgcRateLimitRuleList read FPerEndpoint
write SetPerEndpoint;
—
Each TsgcRateLimitRuleItem in the Rules collection has its own Pattern (wildcards * and ? supported, case-insensitive), Strategy, MaxRequests and WindowSec. The first enabled item whose pattern matches the key wins — no further items are evaluated — and it takes precedence over PerAPIKey, PerUser and PerIP. Use this to give expensive endpoints tighter limits than cheap ones (for example /api/v1/expensive-report at 10 req/min versus /api/v1/status at 1000 req/min).
sgcWSRateLimiter1.PerEndpoint.Enabled := True;
with sgcWSRateLimiter1.PerEndpoint.Rules.Add as TsgcRateLimitRuleItem do
begin
Name := 'expensive-report';
Pattern := '*/api/v1/expensive-report*';
Strategy := rlsSliding;
MaxRequests := 10;
WindowSec := 60;
end;