PPM.Ocelot
Custom implementation of API gateway which features including dynamic routing, load balancing, service discovery, rate limiting, authentication, and scope-based authorization.
Custom implementation of API gateway which features including dynamic routing, load balancing, service discovery, rate limiting, authentication, and scope-based authorization.
dotnet add package PPM.Ocelot
builder.Services.AddOcelot(builder);
app.UseOcelot();
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.13" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
{
"Routes": [],
"GlobalConfiguration": {
"BaseUrl": "https://api.mybusiness.com"
}
}
"Routes": [
{
"UpstreamPathTemplate": "/api/gateway/Blog/{everything}",
"UpstreamHttpMethod": [ "GET", "POST", "PUT", "DELETE" ],
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 5027
}
],
"DownstreamPathTemplate": "/api/Blog/{everything}",
"DownstreamScheme": "http"
}
]
"LoadBalancerOptions": {
"Type": "RoundRobin"
}
"AuthenticationOptions": {
"AuthenticationProviderKey": "Bearer",
"AllowedScopes": []
}
"RateLimitOptions": {
"ClientWhitelist": [], // IP whitelist
"EnableRateLimiting": true, // this must be set to true
"PeriodTimespan": 100, // seconds
"Limit": 1 // count
}
"ServiceName": "auth"