I want to implement a reverse proxy using Yarp. The Api is up and running as i can send request to it. However, anytime i try the same request through the proxy, i get an error 502 Bad gateway
Startup.cs
public void ConfigureServices(IServiceCollection services)
{
services.AddReverseProxy()
.LoadFromConfig(Configuration.GetSection("ReverseProxy"));
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseRouting();
// Register the reverse proxy routes
app.UseEndpoints(endpoints =>
{
endpoints.MapReverseProxy();
});
}
Appsettings
"ReverseProxy": {
"Routes": {
"route1": {
"ClusterId": "cluster1",
"Match": {
//"Methods": [ "GET", "POST", "PUT", "HEAD", "OPTIONS", "DELETE" ],
"Path": "{**catch-all}"
}
}
},
"Clusters": {
"cluster1": {
"Destinations": {
"cluster1/destination1": {
"Address": "https://localhost:44339/"
}
}
}
}
}
I am getting a response - 502 bad gateway anytime i send a request through the proxy