API Gateway with Ocelot
Ocelot is an API Gateway for .NET platform. This project is intended for people using .NET / Core running a micro service / service oriented architecture that needs a unified entry point on their system. However, it will work with anything that uses HTTP and runs on any platform supported by ASP.NET Core.
API Gateway
API Gateway is basically an interface in which it receives calls and redirects to internal services. Basically it is used for the following purposes:
- Filtering
- Traffic Routing
- Security Mechanism
- Expose only one endpoint
API Gateway Pattern
When building a large and complex system using the microservice architecture, with multiple client apps, a good approach to consider is API Gateway Pattern.
This pattern provides a single entry-point for group(s) of microservices. A variation of the API Gateway pattern is also known as the “backend for frontend” (BFF) because you might create multiple API Gateways depending on the different needs from each client app.
Therefore, the API Gateway sits between the client apps and the microservices. It acts as a reverse proxy, routing requests from clients to services.
It can also provide additional cross-cutting features such as authentication, SSL termination, and cache.
Ocelot Features:
- Routing
- Request Aggregation
- Service Discovery with Consul & Eureka
- Service Fabric
- WebSockets
- Authentication
- Authorisation
- Rate Limiting
- Caching
- Retry policies / QoS
- Load Balancing
- Logging / Tracing / Correlation
- Headers / Query String / Claims Transformation
- Custom Middleware / Delegating Handlers
- Configuration / Administration REST API
- Platform / Cloud Agnostic
In the next article I will show you step by step the creation of the project, installation of Nuget packages, Service Discovery with Consul in the Gateway and services, Load Balance and authentication with JWT.
Stay tuned!