I am using Krakend Community edition V2.11.0. I am setting up my API gateway where I want to LoadBalance my backend hosts. I have 2 different Backend host ips. To test it, I try to stop one host and try to hit the API.
Expected :- Krakend should not hit the failing host rather it should hit the healthy one.
Actual:- Krakend sends the requests to both healthy & failing hosts and return the 200 response from health host and returns the 500 error from the failing host . How to get rid of this.
Is it not possible for Krakend to hit the Health backend host all the time whenever there is failure from other host.
Below is the endpoint configuration for the reference.
{
"endpoint": "/api/doctors-list/",
"method": "GET",
"output_encoding": "no-op",
"backend": [
{
"url_pattern": "/himes/api/doctors",
"method": "GET",
"encoding": "no-op",
"host": [
"
http://192.168.20.152:782",
"
http://192.168.20.10:782"
],
"extra_config": {
"modifier/lua-proxy": {
"allow_open_libs": true,
"live": true,
"post": "logToDb(request.load(), response.load());",
"sources": ["./lua/trace_inject.lua", "./lua/log_to_db.lua"]
}
}
}
],
"input_query_strings": [
"LocationID",
"webServicekey"
],
"input_headers": [
"*"
],
"extra_config": {
"qos/http-cache": {
"shared": true
},
"documentation/openapi": {
"description": "Get Doctors List for the facility/branch",
"parameters": [
{
"description": "Branch Code",
"in": "query_string",
"name": "LocationID",
"required": true,
"type": "string"
},
{
"description": "API Key for the client/build",
"in": "query_string",
"name": "webServicekey",
"required": true,
"type": "string"
}
],
"summary": "Get Doctors List for the facility/branch",
"tags": [
"Okadoc"
]
},
"modifier/lua-proxy": {
"allow_open_libs": true,
"live": true,
"pre": "inject_endpoint_header();",
"sources": [
"./lua/inject_endpoint_header.lua"
]
}
}
}