Update the Gateway Settings File as Follow in (GlobalConfiguration):
"ServiceDiscoveryProvider": {
"Host": "localhost",
"Port": 8500,
"Type": "PollConsul",
"PollingInterval": 100
//"Type": "Consul" - Each Request it will update information
/*
Type
Consul, means that Ocelot will get service information from consul per request
PollConsul, means that Ocelot will poll Consul for latest service information
*/
}
Sample Gateway End Point Configuration:
{
"Routes": [
{
"UseServiceDiscovery": true,
"DownstreamPathTemplate": "/v1/{everything}",
"DownstreamScheme": "http",
"ServiceName": "Sample API",
"UpstreamPathTemplate": "/v1/{everything}",
"UpstreamHttpMethod": [ "GET" ],
"Priority": 1,
"ReRoutesCaseSensitive": false,
"LoadBalancerOptions": {
"Type": "LeastConnection"
}
},
{
"DownstreamPathTemplate": "/v1/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 7201
}
],
"UpstreamPathTemplate": "/api/v2/{everything}",
"UpstreamHttpMethod": [ "GET", "POST" ],
"Priority": 1
}
],
"GlobalConfiguration": {
"BaseUrl": "https://localhost:7123",
"ServiceDiscoveryProvider": {
"Host": "localhost",
"Port": 8500,
"Type": "PollConsul",
"PollingInterval": 100
//"Type": "Consul" - Each Request it will update information
/*
Type
Consul, means that Ocelot will get service information from consul per request
PollConsul, means that Ocelot will poll Consul for latest service information
*/
}
}
}