You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Endpoint has following definition [HttpPost("{id:int:min(1)}/lock")]
example request
/api/Apartments/12345/lock
when I hit this 3x I will get rate limited, but then I change variable and request go through.
/api/Apartments/11111/lock
in endpoint definition i thought /*/ between Apartments and lock would take care of this, but it doesnt.
How can I define endpoint path so that variable change does not trick limiter into thinking its a new url.
The text was updated successfully, but these errors were encountered:
Hei, I got it fixed when I found some previous discussions about it.
Made custom classes
public class IpRateLimitConfigurationCustom : RateLimitConfiguration
{
public IpRateLimitConfigurationCustom(IOptions<IpRateLimitOptions> ipOptions, IOptions<ClientRateLimitOptions> clientOptions) : base(ipOptions, clientOptions)
{
}
public override ICounterKeyBuilder EndpointCounterKeyBuilder { get; } = new EndpointCounterKeyBuilder();
}
public class EndpointCounterKeyBuilder : ICounterKeyBuilder
{
public string Build(ClientRequestIdentity requestIdentity, RateLimitRule rule)
{
// This will allow to rate limit /api/values/1 and api/values/2 under same counter
return $"_{rule.Endpoint}";
}
}
used api/Apartments/*
wildcard
and injected my custom configuration class, works now
Hi, im using following settings
Endpoint has following definition
[HttpPost("{id:int:min(1)}/lock")]
example request
/api/Apartments/12345/lock
when I hit this 3x I will get rate limited, but then I change variable and request go through.
/api/Apartments/11111/lock
in endpoint definition i thought /*/ between Apartments and lock would take care of this, but it doesnt.
How can I define endpoint path so that variable change does not trick limiter into thinking its a new url.
The text was updated successfully, but these errors were encountered: