Since ocelot is no longer maintained, I decided to give a go to YARP as my API Gateway but it's giving me this silly error when I access one of my endpoints through it:
"ReverseProxy": {
"Routes": {
"client-route": {
"ClusterId": "client-cluster",
"CorsPolicy": "customPolicy",
"Match": {
"Path": "client-service/{**remainder}"
},
"Transforms": [
{ "X-Forwarded": "Off" },
{
"PathPattern": "/{**remainder}"
}
]
}
},
"Clusters": {
"client-cluster": {
"Destinations": {
"destination1": {
"Address": "https://URLWithSwagger/"
}
}
}
}
}
when using the configuration above, I get the following error:
but when I change the path from "client-service/{**remainder}"
to "/{**remainder}"
, everything works fine! any suggestions on the root of this error?
Update: Here's the program.cs :
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddReverseProxy()//.AddConfigFilter();
.LoadFromConfig(builder.Configuration.GetSection("ReverseProxy"));
var app = builder.Build();
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapReverseProxy();
app.Run();