ratelimit.proto

Package: ratelimit.options.gloo.solo.io

Types:

Source File: github.com/solo-io/gloo/projects/gloo/api/v1/enterprise/options/ratelimit/ratelimit.proto

Descriptor

Descriptors can be nested for your convenience and flexibility

"key": string
"value": string
"rateLimit": .ratelimit.options.gloo.solo.io.RateLimit
"descriptors": []ratelimit.options.gloo.solo.io.Descriptor
"weight": int
"alwaysApply": bool
Field Type Description Default
key string
value string
rateLimit .ratelimit.options.gloo.solo.io.RateLimit
descriptors []ratelimit.options.gloo.solo.io.Descriptor
weight int Each top-level Descriptor defines a new Rate Limit “rule”. When a request comes in, rate limit actions are applied to the request to generate descriptor tuples that are sent to the rate limit server. If any rule is triggered then the entire request returns HTTP 429 Too Many Requests. Typically, rule priority is signalled by nesting descriptors, as the most specific rule match for the descriptor tuple generated by the rate limit actions is used. In rare cases this is too restrictive; instead you can set rule priority by setting weights on your descriptors. All rules with the highest weight are processed, if any of these rules trigger rate limiting then the entire request will return a 429. Rules that are not considered for rate limiting are ignored in the rate limit server, and their request count is not incremented in the rate limit server cache. Defaults to 0; thus all rules are evaluated by default.
alwaysApply bool A boolean override for rule priority via weighted rules. Any rule with alwaysApply set to true will always be considered for rate limiting, regardless of the rule’s weight. The rule with the highest weight will still be considered. (this can be a rule that also has alwaysApply set to true) Defaults to false.

RateLimit

"unit": .ratelimit.options.gloo.solo.io.RateLimit.Unit
"requestsPerUnit": int
Field Type Description Default
unit .ratelimit.options.gloo.solo.io.RateLimit.Unit
requestsPerUnit int

Unit

Name Description
UNKNOWN
SECOND
MINUTE
HOUR
DAY

IngressRateLimit

Basic rate-limiting API

"authorizedLimits": .ratelimit.options.gloo.solo.io.RateLimit
"anonymousLimits": .ratelimit.options.gloo.solo.io.RateLimit
Field Type Description Default
authorizedLimits .ratelimit.options.gloo.solo.io.RateLimit
anonymousLimits .ratelimit.options.gloo.solo.io.RateLimit

Settings

"ratelimitServerRef": .core.solo.io.ResourceRef
"requestTimeout": .google.protobuf.Duration
"denyOnFail": bool
"rateLimitBeforeAuth": bool
Field Type Description Default
ratelimitServerRef .core.solo.io.ResourceRef
requestTimeout .google.protobuf.Duration
denyOnFail bool
rateLimitBeforeAuth bool Set this is set to true if you would like to rate limit traffic before applying external auth to it. Note: When this is true, you will lose some features like being able to rate limit a request based on its auth state.

ServiceSettings

API based on Envoy’s rate-limit service API. (reference here: https://github.com/lyft/ratelimit#configuration) Sample configuration below

descriptors: - key: account_id descriptors: - key: plan value: BASIC rateLimit: requestsPerUnit: 1 unit: MINUTE - key: plan value: PLUS rateLimit: requestsPerUnit: 20 unit: MINUTE

"descriptors": []ratelimit.options.gloo.solo.io.Descriptor
Field Type Description Default
descriptors []ratelimit.options.gloo.solo.io.Descriptor

RateLimitActions

"actions": []ratelimit.options.gloo.solo.io.Action
Field Type Description Default
actions []ratelimit.options.gloo.solo.io.Action descriptors: - key: account_id descriptors: - key: plan value: BASIC rateLimit: requestsPerUnit: 1 unit: MINUTE - key: plan value: PLUS rateLimit: requestsPerUnit: 20 unit: MINUTE.

RateLimitVhostExtension

"rateLimits": []ratelimit.options.gloo.solo.io.RateLimitActions
Field Type Description Default
rateLimits []ratelimit.options.gloo.solo.io.RateLimitActions Define individual rate limits here. Each rate limit will be evaluated, if any rate limit would be throttled, the entire request returns a 429 (gets throttled).

RateLimitRouteExtension

"includeVhRateLimits": bool
"rateLimits": []ratelimit.options.gloo.solo.io.RateLimitActions
Field Type Description Default
includeVhRateLimits bool Whether or not to include rate limits as defined on the VirtualHost in addition to rate limits on the Route.
rateLimits []ratelimit.options.gloo.solo.io.RateLimitActions Define individual rate limits here. Each rate limit will be evaluated, if any rate limit would be throttled, the entire request returns a 429 (gets throttled).

Action

TODO(yuval-k): copied from envoy; will be removed and imported properly in a future when we vendor protos

"sourceCluster": .ratelimit.options.gloo.solo.io.Action.SourceCluster
"destinationCluster": .ratelimit.options.gloo.solo.io.Action.DestinationCluster
"requestHeaders": .ratelimit.options.gloo.solo.io.Action.RequestHeaders
"remoteAddress": .ratelimit.options.gloo.solo.io.Action.RemoteAddress
"genericKey": .ratelimit.options.gloo.solo.io.Action.GenericKey
"headerValueMatch": .ratelimit.options.gloo.solo.io.Action.HeaderValueMatch
Field Type Description Default
sourceCluster .ratelimit.options.gloo.solo.io.Action.SourceCluster Rate limit on source cluster. Only one of sourceCluster, destinationCluster, requestHeaders, remoteAddress, or headerValueMatch can be set.
destinationCluster .ratelimit.options.gloo.solo.io.Action.DestinationCluster Rate limit on destination cluster. Only one of destinationCluster, sourceCluster, requestHeaders, remoteAddress, or headerValueMatch can be set.
requestHeaders .ratelimit.options.gloo.solo.io.Action.RequestHeaders Rate limit on request headers. Only one of requestHeaders, sourceCluster, destinationCluster, remoteAddress, or headerValueMatch can be set.
remoteAddress .ratelimit.options.gloo.solo.io.Action.RemoteAddress Rate limit on remote address. Only one of remoteAddress, sourceCluster, destinationCluster, requestHeaders, or headerValueMatch can be set.
genericKey .ratelimit.options.gloo.solo.io.Action.GenericKey Rate limit on a generic key. Only one of genericKey, sourceCluster, destinationCluster, requestHeaders, or headerValueMatch can be set.
headerValueMatch .ratelimit.options.gloo.solo.io.Action.HeaderValueMatch Rate limit on the existence of request headers. Only one of headerValueMatch, sourceCluster, destinationCluster, requestHeaders, or genericKey can be set.

SourceCluster

The following descriptor entry is appended to the descriptor:

.. code-block:: cpp

(“source_cluster”, “”)

is derived from the :option:--service-cluster option.

Field Type Description Default

DestinationCluster

The following descriptor entry is appended to the descriptor:

.. code-block:: cpp

(“destination_cluster”, “”)

Once a request matches against a route table rule, a routed cluster is determined by one of the following :ref:route table configuration <envoy_api_msg_RouteConfiguration> settings:

Field Type Description Default

RequestHeaders

The following descriptor entry is appended when a header contains a key that matches the header_name:

.. code-block:: cpp

(””, “”)

"headerName": string
"descriptorKey": string
Field Type Description Default
headerName string The header name to be queried from the request headers. The header’s value is used to populate the value of the descriptor entry for the descriptor_key.
descriptorKey string The key to use in the descriptor entry.

RemoteAddress

The following descriptor entry is appended to the descriptor and is populated using the trusted address from :ref:x-forwarded-for <config_http_conn_man_headers_x-forwarded-for>:

.. code-block:: cpp

(“remote_address”, “”)

Field Type Description Default

GenericKey

The following descriptor entry is appended to the descriptor:

.. code-block:: cpp

(“generic_key”, “”)

"descriptorValue": string
Field Type Description Default
descriptorValue string The value to use in the descriptor entry.

HeaderValueMatch

The following descriptor entry is appended to the descriptor:

.. code-block:: cpp

(“header_match”, “”)

"descriptorValue": string
"expectMatch": .google.protobuf.BoolValue
"headers": []ratelimit.options.gloo.solo.io.HeaderMatcher
Field Type Description Default
descriptorValue string The value to use in the descriptor entry.
expectMatch .google.protobuf.BoolValue If set to true, the action will append a descriptor entry when the request matches the headers. If set to false, the action will append a descriptor entry when the request does not match the headers. The default value is true.
headers []ratelimit.options.gloo.solo.io.HeaderMatcher Specifies a set of headers that the rate limit action should match on. The action will check the request’s headers against all the specified headers in the config. A match will happen if all the headers in the config are present in the request with the same values (or based on presence if the value field is not in the config).

Int64Range

Specifies the int64 start and end of the range using half-open interval semantics [start, end).

"start": int
"end": int
Field Type Description Default
start int start of the range (inclusive).
end int end of the range (exclusive).

HeaderMatcher

"name": string
"exactMatch": string
"regexMatch": string
"rangeMatch": .ratelimit.options.gloo.solo.io.Int64Range
"presentMatch": bool
"prefixMatch": string
"suffixMatch": string
"invertMatch": bool
Field Type Description Default
name string Specifies the name of the header in the request.
exactMatch string If specified, header match will be performed based on the value of the header. Only one of exactMatch, regexMatch, rangeMatch, presentMatch, or suffixMatch can be set.
regexMatch string If specified, this regex string is a regular expression rule which implies the entire request header value must match the regex. The rule will not match if only a subsequence of the request header value matches the regex. The regex grammar used in the value field is defined here <https://en.cppreference.com/w/cpp/regex/ecmascript>_. Examples: * The regex \d{3} matches the value 123 * The regex \d{3} does not match the value 1234 * The regex \d{3} does not match the value 123.456. Only one of regexMatch, exactMatch, rangeMatch, presentMatch, or suffixMatch can be set.
rangeMatch .ratelimit.options.gloo.solo.io.Int64Range If specified, header match will be performed based on range. The rule will match if the request header value is within this range. The entire request header value must represent an integer in base 10 notation: consisting of an optional plus or minus sign followed by a sequence of digits. The rule will not match if the header value does not represent an integer. Match will fail for empty values, floating point numbers or if only a subsequence of the header value is an integer. Examples: * For range [-10,0), route will match for header value -1, but not for 0, “somestring”, 10.9, “-1somestring”. Only one of rangeMatch, exactMatch, regexMatch, presentMatch, or suffixMatch can be set.
presentMatch bool If specified, header match will be performed based on whether the header is in the request. Only one of presentMatch, exactMatch, regexMatch, rangeMatch, or suffixMatch can be set.
prefixMatch string If specified, header match will be performed based on the prefix of the header value. Note: empty prefix is not allowed, please use present_match instead. Examples: * The prefix abcd matches the value abcdxyz, but not for abcxyz. Only one of prefixMatch, exactMatch, regexMatch, rangeMatch, or suffixMatch can be set.
suffixMatch string If specified, header match will be performed based on the suffix of the header value. Note: empty suffix is not allowed, please use present_match instead. Examples: * The suffix abcd matches the value xyzabcd, but not for xyzbcd. Only one of suffixMatch, exactMatch, regexMatch, rangeMatch, or prefixMatch can be set.
invertMatch bool If specified, the match result will be inverted before checking. Defaults to false. Examples: * The regex \d{3} does not match the value 1234, so it will match when inverted. * The range [-10,0) will match the value -1, so it will not match when inverted.

QueryParameterMatcher

Query parameter matching treats the query string of a request’s :path header as an ampersand-separated list of keys and/or key=value elements.

"name": string
"value": string
"regex": .google.protobuf.BoolValue
Field Type Description Default
name string Specifies the name of a key that must be present in the requested path’s query string.
value string Specifies the value of the key. If the value is absent, a request that contains the key in its query string will match, whether the key appears with a value (e.g., “?debug=true”) or not (e.g., “?debug”).
regex .google.protobuf.BoolValue Specifies whether the query parameter value is a regular expression. Defaults to false. The entire query parameter value (i.e., the part to the right of the equals sign in “key=value”) must match the regex. E.g., the regex “\d+$” will match “123” but not “a123” or “123a”.