Ocelot 23.4.1
dotnet add package Ocelot --version 23.4.1
NuGet\Install-Package Ocelot -Version 23.4.1
<PackageReference Include="Ocelot" Version="23.4.1" />
paket add Ocelot --version 23.4.1
#r "nuget: Ocelot, 23.4.1"
// Install Ocelot as a Cake Addin #addin nuget:?package=Ocelot&version=23.4.1 // Install Ocelot as a Cake Tool #tool nuget:?package=Ocelot&version=23.4.1
About
Ocelot is a .NET API Gateway. This project is aimed at people using .NET running a microservices / service-oriented architecture that need a unified point of entry into their system. However it will work with anything that speaks HTTP(S) and run on any platform that ASP.NET Core supports.
In particular we want easy integration with IdentityServer reference and Bearer tokens. We have been unable to find this in our current workplace without having to write our own Javascript middlewares to handle the IdentityServer reference tokens. We would rather use the IdentityServer code that already exists to do this.
Ocelot is a bunch of middlewares in a specific order.
Ocelot manipulates the HttpRequest
object into a state specified by its configuration until it reaches a request builder middleware, where it creates a HttpRequestMessage
object which is used to make a request to a downstream service.
The middleware that makes the request is the last thing in the Ocelot pipeline. It does not call the next middleware.
The response from the downstream service is retrieved as the requests goes back up the Ocelot pipeline.
There is a piece of middleware that maps the HttpResponseMessage
onto the HttpResponse
object and that is returned to the client.
That is basically it with a bunch of other features!
Features
A quick list of Ocelot's capabilities, for more information see the Documentation.
- Routing
- Request Aggregation
- GraphQL [^1]
- Service Discovery [^2]
- Service Fabric
- Kubernetes
- Websockets
- Authentication
- Authorization
- Rate Limiting
- Caching
- Quality of Service [^3]
- Load Balancer
- Logging / Tracing / Correlation
- Headers / Method / Query String / Claims Transformation
- Custom Middleware / Delegating Handlers
- Configuration / Administration REST API
- Platform & Cloud Agnostic Building
Install
Ocelot is designed to work with ASP.NET Core and it targets net6.0
, net7.0
and net8.0
frameworks. [^4]
Install Ocelot package and its dependencies using NuGet Package Manager:
Install-Package Ocelot
Or via the .NET CLI:
dotnet add package Ocelot
All versions can be found on nuget.
Documentation
- Ocelot documentation — Read the Docs <br/>This includes lots of information and will be helpful if you want to understand the features Ocelot currently offers.
- Ocelot RST Docs <br/>This includes source code of documentation as .rst files which are up to date for current development.
Coming up
You can see what we are working on in backlog.
Contributing
We love to receive contributions from the community, so please keep them coming 😮ctocat: <br/>Pull requests, issues and commentary welcome!
Please complete the relevant template for issues and PRs. Sometimes it's worth getting in touch with us to discuss changes before doing any work in case this is something we are already doing or it might not make sense. We can also give advice on the easiest way to do things 😮ctocat:
Finally, we mark all existing issues as . [^5] <br/>If you want to contribute for the first time, we suggest looking at a 😮ctocat:
Notes
[^1]: Ocelot doesn’t directly support GraphQL. Developers can easily integrate the GraphQL for .NET library. [^2]: Ocelot does support Consul, Netflix Eureka, Service Fabric service discovery providers, and special modes like Dynamic Routing and Custom Providers. [^3]: Retry policies only via Polly library. [^4]: Starting with v21.0, the solution's code base supports Multitargeting as 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. Find out more here: Target frameworks in SDK-style projects [^5]: See all labels of the repository.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- FluentValidation (>= 11.10.0)
- IPAddressRange (>= 6.0.0)
- Microsoft.AspNetCore.MiddlewareAnalysis (>= 6.0.35)
- Microsoft.AspNetCore.Mvc.NewtonsoftJson (>= 6.0.35)
- Microsoft.Extensions.DiagnosticAdapter (>= 3.1.32)
-
net7.0
- FluentValidation (>= 11.10.0)
- IPAddressRange (>= 6.0.0)
- Microsoft.AspNetCore.MiddlewareAnalysis (>= 7.0.20)
- Microsoft.AspNetCore.Mvc.NewtonsoftJson (>= 7.0.20)
- Microsoft.Extensions.DiagnosticAdapter (>= 3.1.32)
-
net8.0
- FluentValidation (>= 11.10.0)
- IPAddressRange (>= 6.0.0)
- Microsoft.AspNetCore.MiddlewareAnalysis (>= 8.0.10)
- Microsoft.AspNetCore.Mvc.NewtonsoftJson (>= 8.0.10)
- Microsoft.Extensions.DiagnosticAdapter (>= 3.1.32)
NuGet packages (120)
Showing the top 5 NuGet packages that depend on Ocelot:
Package | Downloads |
---|---|
MMLib.SwaggerForOcelot
Swagger generator for Ocelot downstream services. |
|
Ocelot.Provider.Polly
Provides Ocelot extensions to use Polly.NET |
|
Ocelot.Provider.Consul
Provides Ocelot extensions to use Consul |
|
Ocelot.Cache.CacheManager
Provides Ocelot extensions to use CacheManager.Net |
|
2AxisTechnology.Core.CL
Plz don't install. |
GitHub repositories (33)
Showing the top 5 popular GitHub repositories that depend on Ocelot:
Repository | Stars |
---|---|
anjoy8/Blog.Core
💖 ASP.NET Core 8.0 全家桶教程,前后端分离后端接口,vue教程姊妹篇,官方文档:
|
|
phongnguyend/Practical.CleanArchitecture
Full-stack .Net 8 Clean Architecture (Microservices, Modular Monolith, Monolith), Blazor, Angular 18, React 18, Vue 3, BFF with YARP, Domain-Driven Design, CQRS, SOLID, Asp.Net Core Identity Custom Storage, OpenID Connect, Entity Framework Core, OpenTelemetry, SignalR, Hosted Services, Health Checks, Rate Limiting, Cloud Services (Azure, AWS, GCP).
|
|
geffzhang/NanoFabric
基于Consul + .NET Core + Polly + Ocelot + Exceptionless + IdentityServer等开源项目的微服务开发框架
|
|
abpframework/abp-samples
Sample solutions built with the ABP Framework
|
|
CodeMazeBlog/CodeMazeGuides
The main repository for all the Code Maze guides
|
Version | Downloads | Last updated | |
---|---|---|---|
23.4.1 | 222 | 11/22/2024 | |
23.4.0 | 2,599 | 11/18/2024 | |
23.3.6 | 13,556 | 10/31/2024 | |
23.3.4 | 40,444 | 10/3/2024 | |
23.3.3 | 199,027 | 6/11/2024 | |
23.3.0 | 9,657 | 6/8/2024 | |
23.2.2 | 170,660 | 4/5/2024 | |
23.2.0 | 9,341 | 4/1/2024 | |
23.1.0 | 141,374 | 3/4/2024 | |
23.0.0 | 77,042 | 2/13/2024 | |
22.0.1 | 222,373 | 12/8/2023 | |
22.0.0 | 38,870 | 11/28/2023 | |
21.0.0 | 24,922 | 11/21/2023 | |
20.0.0 | 128,448 | 10/7/2023 | |
19.0.4 | 12,678 | 10/6/2023 | |
19.0.3 | 25,588 | 9/21/2023 | |
19.0.2 | 221,235 | 4/22/2023 | |
19.0.1 | 4,282 | 4/22/2023 | |
19.0.0 | 3,787 | 4/22/2023 | |
18.0.0 | 2,233,749 | 1/20/2022 | |
17.0.1 | 222,723 | 12/20/2021 | |
17.0.0 | 1,223,219 | 12/11/2020 | |
16.0.2 | 18,387 | 12/11/2020 | |
16.0.1 | 1,268,145 | 5/25/2020 | |
16.0.0 | 54,246 | 5/23/2020 | |
1.1.0 | 3,309 | 2/2/2017 |