I am using Microsoft C# .NET YARP as an API gateway in front of ASP.NET Core Web API (latest version) with Swagger and Kestrel. YARP is used for intern redirections to many microservices.
Questions:
- I am facing 504 http API gateway error for requests that execute more than approx. 2 minutes from swagger UI. How do I set an increased timeout?
Ex: https://URL/swagger/index.html => Execute POST FUNCTION => YARP_API_GATEWAY => SERVICE_API_PORT
- If an internal service destination (endpoint) is down for any reason, how do I configure "Failover" to another destination?
Ex. configuration:
"ReverseProxy": {
"Routes": [
{
"RouteId": "Service1",
"ClusterId": "ServiceCluster1",
"Match": {
"Path": "/api/Action1/{**rest}"
},
"Transforms": [
{ "RequestHeadersCopy": "true" },
{ "RequestHeaderOriginalHost": "true" }
]
},
{
"RouteId": "Service2",
"ClusterId": "ServiceCluster2",
"Match": {
"Path": "/api/Action2/{**rest}"
},
"Transforms": [
{ "RequestHeadersCopy": "true" },
{ "RequestHeaderOriginalHost": "true" }
]
],
"Clusters": {
"ServiceCluster1": {
"Destinations": {
"ServiceCluster1/destination1": {
"Address": "http://localhost:5001/"
},
"ServiceCluster1/destination2": {
"Address": "http://localhost:5002/"
}
}
},
"ServiceCluster2": {
"Destinations": {
"ServiceCluster2/destination1": {
"Address": "http://localhost:5003/"
},
"ServiceCluster2/destination2": {
"Address": "http://localhost:5004/"
}
}
},
}