-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Add descriptor support in HTTP Local Rate Limiting #14172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -103,6 +103,89 @@ The route specific configuration: | |
| Note that if this filter is configured as globally disabled and there are no virtual host or route level | ||
| token buckets, no rate limiting will be applied. | ||
|
|
||
| .. _config_http_filters_local_rate_limit_descriptors: | ||
|
|
||
| Using Descriptors to rate limit on | ||
| ---------------------------------- | ||
|
|
||
| Descriptors can be used to override local rate limiting based on presence of certain descriptors/route actions. | ||
| A route's :ref:`rate limit action <envoy_v3_api_msg_config.route.v3.RateLimit>` is used to match up a | ||
| :ref:`local descriptor <envoy_v3_api_msg_extensions.common.ratelimit.v3.LocalRateLimitDescriptor>` in the filter config descriptor list. | ||
| The local descriptor's token bucket config is used to decide if the request should be | ||
| rate limited or not, if the local descriptor's entries match the route's rate limit actions descriptor entries. | ||
| Otherwise the default token bucket config is used. | ||
|
|
||
| Example filter configuration using descriptors is as follows: | ||
|
|
||
| .. validated-code-block:: yaml | ||
| :type-name: envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager | ||
|
|
||
| route_config: | ||
| name: local_route | ||
| virtual_hosts: | ||
| - name: local_service | ||
| domains: ["*"] | ||
| routes: | ||
| - match: { prefix: "/foo" } | ||
| route: { cluster: service_protected_by_rate_limit } | ||
| typed_per_filter_config: | ||
| envoy.filters.http.local_ratelimit: | ||
| "@type": type.googleapis.com/envoy.extensions.filters.http.local_ratelimit.v3.LocalRateLimit | ||
| stat_prefix: test | ||
| token_bucket: | ||
mattklein123 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| max_tokens: 1000 | ||
| tokens_per_fill: 1000 | ||
| fill_interval: 60s | ||
| filter_enabled: | ||
| runtime_key: test_enabled | ||
| default_value: | ||
| numerator: 100 | ||
| denominator: HUNDRED | ||
| filter_enforced: | ||
| runtime_key: test_enforced | ||
| default_value: | ||
| numerator: 100 | ||
| denominator: HUNDRED | ||
| response_headers_to_add: | ||
| - append: false | ||
| header: | ||
| key: x-test-rate-limit | ||
| value: 'true' | ||
| descriptors: | ||
| - entries: | ||
| - key: client_id | ||
| value: foo | ||
| - key: path | ||
| value: /foo/bar | ||
| token_bucket: | ||
| max_tokens: 10 | ||
| tokens_per_fill: 10 | ||
| fill_interval: 60s | ||
| - entries: | ||
| - key: client_id | ||
| value: foo | ||
| - key: path | ||
| value: /foo/bar2 | ||
| token_bucket: | ||
| max_tokens: 100 | ||
| tokens_per_fill: 100 | ||
| fill_interval: 60s | ||
| - match: { prefix: "/" } | ||
| route: { cluster: default_service } | ||
| rate_limits: | ||
|
||
| - actions: # any actions in here | ||
| - request_headers: | ||
| header_name: ":path" | ||
| descriptor_key: "path" | ||
| - generic_key: | ||
| descriptor_value: "foo" | ||
| descriptor_key: "client_id" | ||
|
|
||
| For this config, requests are ratelimited for routes prefixed with "/foo" | ||
| In that, if requests come from client_id "foo" for "/foo/bar" path, then 10 req/min are allowed. | ||
| But if they come from client_id "foo" for "/foo/bar2" path, then 100 req/min are allowed. | ||
| Otherwise 1000 req/min are allowed. | ||
|
|
||
| Statistics | ||
| ---------- | ||
|
|
||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.