.NET API Gateway
Route path template placeholders and their validation rules
Special thanks to Guillaume Gnaegi and Fabrizio Mancin!
The bug is related to the Placeholders feature in Configuration and Routing. The bug was introduced in version 23.2.0 as a part of PR #1927.
The new validation rules of the FileConfigurationFluentValidator
class do not allow the Ocelot app to start when implicit placeholders are defined in custom implementations, such as middlewares, delegating handlers, and replaced services in the dependency injection (DI) container.
These new rules are capable of validating explicit placeholders only within the UpstreamPathTemplate
and DownstreamPathTemplate
properties. Unfortunately, they cannot oversee implicit placeholders in custom implementations, and they do not validate early during the Ocelot app startup process.
Ensure that you avoid using version 23.2.0. If you are currently on that version, upgrade to version 23.2.2 by applying this hotfix patch.
With version 23.2.0, particularly if you have overridden certain service classes or implemented custom logic that manipulates placeholders, you may encounter Ocelot app crashes accompanied by the following errors in the log:
One or more errors occurred. (Unable to start Ocelot, errors are: XXX)
where XXX
are the following validation error messages:
UpstreamPathTemplate 'UUU' doesn't contain the same placeholders in DownstreamPathTemplate 'DDD'
DownstreamPathTemplate 'DDD' doesn't contain the same placeholders in UpstreamPathTemplate 'UUU'
Finally, the validation rules resulted from the incorrect assumption that placeholders are always explicit and can be validated early. Therefore, custom implementations and feature services in the dependency injection (DI) container, which rely on or manipulate placeholders, should validate the configuration JSON and appropriate options later, directly within their service implementations.
2ded8726 by Raman Maksimchuk on Friday, April 05 at 15:13 → Release 23.2.1-2 artifacts | +semver: patch 14c6d82b by Raman Maksimchuk on Friday, April 05 at 12:57 → #2031 Don't validate placeholders in templates (#2032) d1855cb9 by Raman Maksimchuk on Thursday, April 04 at 00:17 → #1673 #1672 Update Docker for CircleCI builds (#2030)
Read the Docs: Ocelot 23.2
This is a technical release: no other information.
Full Changelog: https://github.com/ThreeMammals/Ocelot/compare/23.2.0...23.2.1
Codenamed: Lunar Eclipse Read the Docs: Ocelot 23.2
AddOcelot
method merges the ocelot.*.json files into a single ocelot.json file as the primary configuration file, which is written back to disk and then added to the IConfigurationBuilder
for the well-known IConfiguration
. You can now call another AddOcelot
method that adds the merged JSON directly from memory to the IConfigurationBuilder
, using AddJsonStream
instead.
See more details in Configuration Overview of Dependency Injection.[Obsolete]
attribute and renamed using the V7
suffix. And the old v7 implementation has been moved to the v7 namespace.
See more details in Polly v7 vs v8 section of Quality of Service chapter.IServiceCollection
DI extensions to register Ocelot services resulted in the ServiceCollection
provider being forced to be created by calling BuildServiceProvider()
.
This resulted in problems with dependency injection libraries, or worse, causing the Ocelot app to crash!
See more in the ServiceCollectionExtensions class. Thanks to @ArwynFr!1st :1st_place_medal: goes to Eirik Bjornset for delivering 1 feature in 19 files changed 2nd :2nd_place_medal: goes to Aly Kafoury for delivering 1 feature in 9 files changed 3rd :3rd_place_medal: goes to Adrien Hupond for delivering 1 feature in 6 files changed
:star: Adrien Hupond, @ArwynFr :star: Aly Kafoury, @AlyHKafoury :star: Eirik Bjornset, @ebjornset :star: Raman Maksimchuk, @raman-m :star: Raynald Messié, @RaynaldM
Milestone: February'24
IServiceCollection
(#1986)AddOcelot
method to support merging of configuration files to memory (#1227)Codenamed as Hornussen Sport Read the Docs: Ocelot 23.1
HttpContext
is not copied when there is only one downstream route, and etc.HttpContext.User
information was not copied if there was more than one downstream request.chunked
was present even when there was no content or the request body size was 0. These cases are now addressed.AddPolly
extension methods.PayloadTooLargeError
(Ocelot error code 41
).1st :1st_place_medal: goes to Guillaume Gnaegi for delivering 2 features 2nd :2nd_place_medal: goes to Alexander Reinert for delivering 1 feature in 8 files changed 3rd :3rd_place_medal: goes to Steven Liekens for delivering 1 feature in 5 files changed with 353 insertions
:star::star: Guillaume Gnaegi, @ggnaegi :star: Alexander Reinert, @alexreinert :star: Chris Williams, @williamscs :star: Masoud Bahrami, @masoud-bahrami :star: Raman Maksimchuk, @raman-m :star: Raynald Messié, @RaynaldM :star: Steven, @sliekens :star: Ugway77, @Ugway77
Milestone: January'24
IOException
while reading incoming request body (#1769)HttpRequesterMiddleware
(#1953)User
in MultiplexingMiddleware
(#1462)DistributedCacheRateLimitCounterHandler
class (#1969)Codenamed as Sunny Koliada Read the Docs: Ocelot 23.0
RequestMapper
with a brand new StreamHttpContent
class, in Ocelot.Request.Mapper
namespace. The request body is no longer copied when it is handled by the API gateway, avoiding Out-of-Memory issues in pods/containers. This significantly reduces the gateway's memory consumption, and allows you to transfer content larger than 2 GB in streaming scenarios.Ocelot.Requester
namespace. We have replaced the HttpClient class with HttpMessageInvoker, which is the base class for HttpClient
. The overall logic for managing the pool has been simplified, resulting in a reduction in the number of CPU cycles.3 hours chart | 1 day chart | 2 days chart |
---|---|---|
~300 MB on average | ~320 MB on average | ~340 MB on average |
Ocelot.Cache.CacheManager: Introduced default cache key generator with improved performance (the DefaultCacheKeyGenerator
class). Old version of CacheKeyGenerator
had significant performance issue when reading full content of HTTP request for caching key calculation of MD5 hash value. This hash value was excluded from the caching key.
Ocelot.Provider.Kubernetes: Fixed long lasting breaking change being added in version 15.0.0, see commit https://github.com/ThreeMammals/Ocelot/commit/6e5471a714dddb0a3a40fbb97eac2810cee1c78d. The bug persisted for more than 3 years in versions 15.0.0-22.0.1, being masked multiple times via class renaming! Special Thanks to @ZisisTsatsas who once again brought this issue to our attention, and our team finally realized that we had a breaking change and the provider was broken.
Ocelot.Provider.Polly: A minor changes without feature delivery. We are preparing for a major update to the package in the next release.
AuthenticationMiddleware
: Added new Multiple Authentication Schemes feature by @MayorSheFFOutputCacheMiddleware
, RequestIdMiddleware
: Added new Cache by Header Value feature by @EngRajabi, and redesigned as Default CacheKeyGenerator feature by @raman-mDownstreamUrlCreatorMiddleware
: Fixed bug for ending/omitting slash in path templates aka Empty placeholders feature by @AlyHKafouryConfigurationMiddleware
, HttpRequesterMiddleware
, ResponderMiddleware
: System upgrade for Custom HttpMessageInvoker pooling feature by @ggnaegiDownstreamRequestInitialiserMiddleware
: System upgrade for Performance of Request Mapper feature by @ggnaegiOcelot.Benchmarks
testing project has been updated with new PayloadBenchmarks
and ResponseBenchmarks
by @ggnaegiOcelot.AcceptanceTests
testing project has been refactored by @raman-m using the new AuthenticationSteps
class, and more refactoring will be done in future releases1st :1st_place_medal: goes to Guillaume Gnaegi for delivering 3 features 2nd :2nd_place_medal: goes to Igor Polishchuk for delivering 1 feature in 25 files changed 3rd :3rd_place_medal: goes to Aly Kafoury for delivering 1 feature in 9 files changed
:star::star::star: Guillaume Gnaegi, @ggnaegi :star::star: Raman Maksimchuk, @raman-m :star: Aly Kafoury, @AlyHKafoury :star: Igor Polishchuk, @MayorSheFF :star: Tanmay Seth, @ks1990cn :star: Zisis Tsatsas, @ZisisTsatsas :star: Mohsen Rajabi, @EngRajabi
Kube
service discovery provider (#1954)HttpMessageInvoker
pooling (#1824)We would like to share our team's plans for the future regarding: development trends, ideas, community expectations, etc.
Without a doubt, we care about code quality every day, following best development practices. And we review, test, refactor, and redesign features with overall performance in mind. In the next few releases (versions 23.x-24.0) we will take care of: generic providers, multiplexing middleware (Aggregation feature), memory management.
There is a lot of community interest in this HTTP-based protocol.
Consul is our leading technology for service discovery. We are constantly improving the use cases for the Ocelot.Provider.Consul
package and trying to improve the code inside the package.
Polly was released with the new v.8.2+ after .NET 8. So we have to update Ocelot.Provider.Polly
package taking into account new Polly behavior of redesigned features.
Brainstorming to redesign Rate Limiting, Websockets. More details in future release notes.
Planning of support for Swagger and gRPC proto. More details in future release notes.
Default timeout vs the Quality of Service feature
Special thanks to Alvin Huang!
The bug is related to the Quality of Service feature (aka QoS) and the HttpClient.Timeout property.
QoSOptions
section is defined in the route config, then the bug is masked rather than active, and the timeout value is assigned from the QoS TimeoutValue property.QoSOptions
section is not defined in the route config or the TimeoutValue property is missing, then the bug is active and affects downstream requests that never time out.FileQoSOptions
class. Make sure your custom code proper usage of the Ocelot.Configuration.DownstreamRoute
class QosOptions.TimeoutValue property!In version 22.0, the bug was found in the explicit default constructor of the FileQoSOptions class with a maximum TimeoutValue. Previously, the default constructor was implicit with the default assignment of zero 0
to all int
properties.
The new explicit default constructor breaks the old implementation of QoS TimeoutValue logic, as our QoS documentation states:
Finally, the "default 90 second" logic for HttpClient
breaks down when there are no QoS options and all requests on those routes are infinite, if, for example, downstream services are down or stuck.
:star: Alvin Huang, @huanguolin :star: Raman Maksimchuk, @raman-m
Tag v22.0 → https://github.com/ThreeMammals/Ocelot/commit/6740f5059f8d375b568726498357709a4e1a3ed2
Codenamed as Swiss Locomotive Read the Docs: Ocelot 22.0
WriteLog
method for the OcelotLogger
string.Format
or interpolated stringsILogger.IsEnabled
before calling the native WriteLog
implementation and invoking string factory method1st :1st_place_medal: goes to Guillaume Gnaegi for delivering 2 features in 99 files changed 2nd :2nd_place_medal: goes to Raynald Messié for delivering 2 features in 15 files changed 3rd :3rd_place_medal: goes to @jlukawska for delivering 1 feature in 51 files changed
:star::star::star: @raman-m :star::star: Guillaume Gnaegi, @ggnaegi :star::star: Raynald Messié, @RaynaldM :star: Samuel Poirier, @sam9291 :star: Stjepan, @wast :star: @jlukawska
Read article: Announcing .NET 8 by Gaurav Seth, on November 14th, 2023 Read the Docs: Ocelot 21.0
We are pleased to announce to you that we can now offer the support of .NET 8. But that is not all, in this release, we are adopting support of several versions of the .NET framework through multitargeting. The Ocelot distribution is now compatible with .NET 6, 7 and 8. :tada:
In the future, we will try to ensure the support of the .NET SDKs that are still actively maintained by the .NET team and community. Current .NET versions in support are the following: 6, 7, 8.
As an ASP.NET Core app, now Ocelot targets net6.0
, net7.0
and net8.0
frameworks. Starting with v21.0.0, the solution's code base supports Multitargeting as SDK-style projects. Find out more here: Target frameworks in SDK-style projects.
It should be easier for teams to move between (migrate to) .NET 6, 7 and 8 frameworks. Also, new features will be available for all .NET SDKs which we support via multitargeting.
1st :1st_place_medal: goes to Guillaume Gnaegi for delivering 1 feature in 63 files changed 2nd :2nd_place_medal: goes to Raman Maksimchuk for delivering 1 feature in 17 files changed 3rd :3rd_place_medal: goes to @raman-m for delivering 1 feature in 5 files changed
:star: Guillaume Gnaegi, @ggnaegi :star: Raman Maksimchuk, @raman-m
Read the Docs: Ocelot 20.0
Special thanks to @ggnaegi!
:star: Guillaume Gnaegi, @ggnaegi :star: Raman Maksimchuk, @raman-m
Codenamed as Polish Apple Read the Docs: Ocelot 20.0
1st :1st_place_medal: goes to Raman Maksimchuk for delivering 5 features 2nd :2nd_place_medal: goes to @jlukawska for delivering 3 features 3rd :3rd_place_medal: goes to Guillaume Gnaegi for delivering 2 features
:star::star::star::star::star: Raman Maksimchuk, @raman-m :star::star::star: @jlukawska :star::star: Guillaume Gnaegi, @ggnaegi :star: Anthony Steele, @AnthonySteele :star: Ben Bartholomew, @ben-bartholomew :star: @DanHarltey :star: Fabrizio Mancin, @Fabman08 :star: Freddy, @fku- :star: Kevin Grossmann, @grssmnn :star: Marco, @eddex :star: Roman, @ArtRoman :star: Thiago Loureiro, @thiagoloureiro :star: Vijay Karavadra, @vijay-karavadra :star: guoyongchang, @guoyongchang :star: leonluc-dev, @leonluc-dev :star: zhangq, @zqlovejyc