Class ThrottlingSentinelOptions
Configuration options for ThrottlingSentinelMiddleware.
Inheritance
Namespace: Cuemon.AspNetCore.Http.Throttling
Assembly: Cuemon.AspNetCore.dll
Syntax
public class ThrottlingSentinelOptions
Constructors
| Improve this DocThrottlingSentinelOptions()
Initializes a new instance of the ThrottlingSentinelOptions class.
Declaration
public ThrottlingSentinelOptions()
Remarks
The following table shows the initial property values for an instance of ThrottlingSentinelOptions.
Property | Initial Value |
---|---|
RateLimitHeaderName | X-RateLimit-Limit |
RateLimitRemainingHeaderName | X-RateLimit-Remaining |
RateLimitResetHeaderName | X-RateLimit-Reset |
UseRetryAfterHeader | true |
RetryAfterHeader | ThrottlingRetryAfterHeader.DeltaSeconds |
TooManyRequestsMessage | Throttling rate limit quota violation. Quota limit exceeded. |
ContextResolver | null |
Quota | null |
ResponseBroker | A System.Net.Http.HttpResponseMessage initialized to a HTTP status code 429 with zero of one Retry-After header and a body of TooManyRequestsMessage. |
Properties
| Improve this DocContextResolver
Gets or sets the function delegate that will resolve a unique context of the throttling middleware (eg. IP-address, Authorization header, etc.).
Declaration
public Func<HttpContext, string> ContextResolver { get; set; }
Property Value
Type | Description |
---|---|
System.Func<Microsoft.AspNetCore.Http.HttpContext, System.String> | The function delegate that will resolve a unique context of the throttling middleware. |
Quota
Gets or sets the allowed quota for a given context.
Declaration
public ThrottleQuota Quota { get; set; }
Property Value
Type | Description |
---|---|
ThrottleQuota | The allowed quota for a given context. |
RateLimitHeaderName
Gets or sets the name of the rate limit HTTP header.
Declaration
public string RateLimitHeaderName { get; set; }
Property Value
Type | Description |
---|---|
System.String | The name of the rate limit HTTP header. |
RateLimitRemainingHeaderName
Gets or sets the name of the rate limit remaining HTTP header.
Declaration
public string RateLimitRemainingHeaderName { get; set; }
Property Value
Type | Description |
---|---|
System.String | The name of the rate limit remaining HTTP header. |
RateLimitResetHeaderName
Gets or sets the name of the rate limit reset HTTP header.
Declaration
public string RateLimitResetHeaderName { get; set; }
Property Value
Type | Description |
---|---|
System.String | The name of the rate limit reset HTTP header. |
ResponseBroker
Gets or sets the function delegate that configures the response in the form of a System.Net.Http.HttpResponseMessage.
Declaration
public Func<TimeSpan, DateTime, HttpResponseMessage> ResponseBroker { get; set; }
Property Value
Type | Description |
---|---|
System.Func<System.TimeSpan, System.DateTime, System.Net.Http.HttpResponseMessage> | The function delegate that configures the response in the form of a System.Net.Http.HttpResponseMessage. |
RetryAfterHeader
Gets or sets the preferred Retry-After HTTP header value that conforms with RFC 2616.
Declaration
public ThrottlingRetryAfterHeader RetryAfterHeader { get; set; }
Property Value
Type | Description |
---|---|
ThrottlingRetryAfterHeader | The preferred Retry-After HTTP header value that conforms with RFC 2616. |
TooManyRequestsMessage
Gets or sets the message of a throttled request that has exceeded the rate limit.
Declaration
public string TooManyRequestsMessage { get; set; }
Property Value
Type | Description |
---|---|
System.String | The message of a throttled request that has exceeded the rate limit. |
UseRetryAfterHeader
Gets or sets a value indicating whether to include a Retry-After HTTP header specifying how long to wait before making a new request.
Declaration
public bool UseRetryAfterHeader { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|