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
> PDF Doc: [Ocelot23.3](https://ocelot.readthedocs.io/_/downloads/en/{0}/pdf/)
4
+
> Hot fixed version: [23.3.4](https://github.com/ThreeMammals/Ocelot/releases/tag/23.3.4)
6
5
7
-
❤️ A heartfelt "Thank You" to [Roman Shevchik](https://github.com/antikorol) and [Massimiliano Innocenti](https://github.com/minnocenti901) for their contributions in testing and reporting the [Service Discovery](https://github.com/ThreeMammals/Ocelot/labels/Service%20Discovery) issues, #2110 and #2119, respectively!
8
-
9
-
### ℹ️ About
10
-
This release delivers a number of bug fixes for the predecessor's [23.3.0](https://github.com/ThreeMammals/Ocelot/releases/tag/23.3.0) release, which is full of new features but was not tested well. All bugs were combined into the [v23.3 Hotfixes](https://github.com/ThreeMammals/Ocelot/milestone/8) milestone.
11
-
12
-
Following the substantial refactoring of [Service Discovery](https://github.com/ThreeMammals/Ocelot/blob/main/docs/features/servicediscovery.rst) providers in the [23.3.0](https://github.com/ThreeMammals/Ocelot/releases/tag/23.3.0) release, the community identified and we have acknowledged several [critical service discovery defects](https://github.com/ThreeMammals/Ocelot/issues?q=is%3Aissue+milestone%3A%22v23.3+Hotfixes%22+label%3A%22Service+Discovery%22) with providers such as [Kube](https://github.com/ThreeMammals/Ocelot/blob/main/docs/features/kubernetes.rst) and [Consul](https://github.com/ThreeMammals/Ocelot/blob/main/docs/features/servicediscovery.rst#consul). The `Kube` provider, while somewhat unstable, remained operational; however, the `Consul` provider was entirely non-functional.
13
-
14
-
📓 If your projects rely on the [Service Discovery](https://ocelot.readthedocs.io/en/latest/features/servicediscovery.html) feature and cannot function without it, please upgrade to this version to utilize the full list of features of version [23.3.0](https://github.com/ThreeMammals/Ocelot/releases/tag/23.3.0).
15
-
16
-
### 🧑💻 Technical Information
17
-
A comprehensive explanation of the technical details would span several pages; therefore, it is advisable for fans of Ocelot to review all pertinent technical information within the issue descriptions associated with [the milestone](https://github.com/ThreeMammals/Ocelot/milestone/8).
18
-
Our team has implemented some **Breaking Changes** which we urge you to review carefully (details follow).
19
-
20
-
### ⚠️ Breaking Changes
21
-
Listed by priority:
22
-
-`ILoadBalancer` interface alteration: Method `Lease` is now `LeaseAsync`.
-`DefaultConsulServiceBuilder` constructor modification: The first parameter's type has been changed from `Func<ConsulRegistryConfiguration>` to `IHttpContextAccessor`.
26
-
Class FQN: `Ocelot.Provider.Consul.DefaultConsulServiceBuilder`
- Adjustments to `Lease` type: The `Lease` has been restructured from a class to a structure and elevated in the namespace hierarchy.
29
-
Struct FQN: `Ocelot.LoadBalancer.Lease`
30
-
31
-
📓 Should your [custom solutions](https://ocelot.readthedocs.io/en/latest/search.html?q=custom) involve overriding default Ocelot classes and their behavior, redevelopment or at least recompilation of the solution, followed by deployment, will be necessary.
6
+
### :information_source: About
7
+
This documentation patch pertains to HTML and PDF document layouts.
Copy file name to clipboardExpand all lines: docs/features/ratelimiting.rst
+44-19
Original file line number
Diff line number
Diff line change
@@ -27,23 +27,25 @@ To implement *rate limiting* for a Route, you need to incorporate the following
27
27
"Limit": 1
28
28
}
29
29
30
-
* **ClientWhitelist** - An array containing the whitelisted clients. Clients listed here will be exempt from rate limiting.
31
-
For more information on the **ClientIdHeader** option, refer to the :ref:`rl-global-configuration` section.
32
-
* **EnableRateLimiting** - This setting enables rate limiting on endpoints.
33
-
* **Period** - This parameter defines the duration for which the limit is applicable, such as ``1s`` (seconds), ``5m`` (minutes), ``1h`` (hours), and ``1d`` (days).
34
-
If you reach the exact **Limit** of requests, the excess occurs immediately, and the **PeriodTimespan** begins.
35
-
You must wait for the **PeriodTimespan** duration to pass before making another request.
36
-
Should you exceed the number of requests within the period more than the **Limit** permits, the **QuotaExceededMessage** will appear in the response, accompanied by the **HttpStatusCode**.
37
-
* **PeriodTimespan** - This parameter indicates the time in **seconds** after which a retry is permissible.
38
-
During this interval, the **QuotaExceededMessage** will appear in the response, accompanied by an **HttpStatusCode**.
30
+
* ``ClientWhitelist``: An array containing the whitelisted clients. Clients listed here will be exempt from rate limiting.
31
+
For more information on the ``ClientIdHeader`` option, refer to the :ref:`rl-global-configuration` section.
32
+
* ``EnableRateLimiting``: This setting enables rate limiting on endpoints.
33
+
* ``Period``: This parameter defines the duration for which the limit is applicable, such as ``1s`` (seconds), ``5m`` (minutes), ``1h`` (hours), and ``1d`` (days).
34
+
If you reach the exact ``Limit`` of requests, the excess occurs immediately, and the ``PeriodTimespan`` begins.
35
+
You must wait for the ``PeriodTimespan`` duration to pass before making another request.
36
+
Should you exceed the number of requests within the period more than the ``Limit`` permits, the ``QuotaExceededMessage`` will appear in the response, accompanied by the ``HttpStatusCode``.
37
+
* ``PeriodTimespan``: This parameter indicates the time in **seconds** after which a retry is permissible.
38
+
During this interval, the ``QuotaExceededMessage`` will appear in the response, accompanied by an ``HttpStatusCode``.
39
39
Clients are advised to consult the ``Retry-After`` header to determine the timing of subsequent requests.
40
-
* **Limit** - This parameter defines the upper limit of requests a client is allowed to make within a specified **Period**.
40
+
* ``Limit``: This parameter defines the upper limit of requests a client is allowed to make within a specified ``Period``.
41
41
42
42
.. _rl-global-configuration:
43
43
44
44
Global Configuration
45
45
^^^^^^^^^^^^^^^^^^^^
46
46
47
+
Global options are only accessible in the special :ref:`routing-dynamic` mode.
48
+
47
49
You can set the following in the ``GlobalConfiguration`` section of `ocelot.json`_:
48
50
49
51
.. code-block:: json
@@ -58,26 +60,49 @@ You can set the following in the ``GlobalConfiguration`` section of `ocelot.json
58
60
}
59
61
}
60
62
61
-
* **DisableRateLimitHeaders** - Determines if the ``X-Rate-Limit`` and ``Retry-After`` headers are disabled.
62
-
* **QuotaExceededMessage** - Defines the message displayed when the quota is exceeded. It is optional and the default message is informative.
63
-
* **HttpStatusCode** - Indicates the HTTP status code returned during *rate limiting*. The default value is **429** (`Too Many Requests`_).
64
-
* **ClientIdHeader** - Specifies the header used to identify clients, with ``ClientId`` as the default.
65
63
66
-
Future and ASP.NET Core Implementation
67
-
--------------------------------------
64
+
.. list-table::
65
+
:widths: 35 65
66
+
:header-rows: 1
67
+
68
+
* - *Property*
69
+
- *Description*
70
+
* - ``DisableRateLimitHeaders``
71
+
- Determines if the ``X-Rate-Limit`` and ``Retry-After`` headers are disabled
72
+
* - ``QuotaExceededMessage``
73
+
- Defines the message displayed when the quota is exceeded. It is optional and the default message is informative.
74
+
* - ``HttpStatusCode``
75
+
- Indicates the HTTP status code returned during *rate limiting*. The default value is **429** (`Too Many Requests`_).
76
+
* - ``ClientIdHeader``
77
+
- Specifies the header used to identify clients, with ``ClientId`` as the default.
78
+
79
+
Notes
80
+
"""""
81
+
82
+
1. Global ``RateLimitOptions`` are supported when the :ref:`sd-dynamic-routing` feature is configured with :doc:`../features/servicediscovery`.
83
+
Hence, if :doc:`../features/servicediscovery` is not set up, only the options for static routes need to be defined to impose limitations at the route level.
84
+
2. Global *Rate Limiting* options may not be practical because they impose limits on all routes.
85
+
It's reasonable to assert that in a Microservices architecture, it's an unusual approach to apply the same limitations to all routes.
86
+
Configuring per-route limiting could be a more tailored solution.
87
+
Global *Rate Limiting* is logical if all routes share the same downstream hosts, thus limiting the usage of a single service.
88
+
3. *Rate Limiting* is now built-in with ASP.NET Core 7, as discussed in the following topic below.
89
+
Our team holds the view that the ASP.NET ``RateLimiter`` enables global limitations through its rate limiting policies.
90
+
91
+
Future and ASP.NET Implementation
92
+
---------------------------------
68
93
69
94
The Ocelot team is contemplating a redesign of the *Rate Limiting* feature following the `Announcing Rate Limiting for .NET`_ by Brennan Conroy on July 13th, 2022.
70
95
Currently, no decision has been made, and the previous version of the feature remains part of the `20.0`_ release for .NET 7. [#f2]_
71
96
72
-
Discover the new features being introduced in the ASP.NET Core 7.0 release:
97
+
Discover the new features in the ASP.NET Core 7.0 release:
73
98
74
99
* The `RateLimiter Class <https://learn.microsoft.com/en-us/dotnet/api/system.threading.ratelimiting.ratelimiter>`_, available since ASP.NET Core 7.0
75
100
* The `System.Threading.RateLimiting <https://www.nuget.org/packages/System.Threading.RateLimiting>`_ NuGet package
76
101
* The `Rate limiting middleware in ASP.NET Core <https://learn.microsoft.com/en-us/aspnet/core/performance/rate-limit>`_ article by Arvin Kahbazi, Maarten Balliauw, and Rick Anderson
77
102
78
-
While retaining the old implementation as an Ocelot built-in feature makes sense, we plan to transition to the new Rate Limiter from the ``Microsoft.AspNetCore.RateLimiting`` namespace.
103
+
While it makes sense to retain the old implementation as a built-in feature of Ocelot, we are planning to transition to the new Rate Limiter from the ``Microsoft.AspNetCore.RateLimiting`` namespace.
79
104
80
-
Please share your thoughts with us in the `Discussions <https://github.com/ThreeMammals/Ocelot/discussions>`_ space of the repository. |octocat|
105
+
We invite you to share your thoughts with us in the `Discussions <https://github.com/ThreeMammals/Ocelot/discussions>`_ space of the repository. |octocat|
0 commit comments