-
Hello, I have a scenario where I need YARP to follow redirects (http 302) instead of returning them to the client. I've tried setting builder.Services.AddReverseProxy()
.ConfigureHttpClient((context, handler) =>
{
handler.AllowAutoRedirect = true;
})
.LoadFromMemory(GetRoutes(), GetClusters()); My routes and clusters are very basic catch all to a single http endpoint. Is there any way to configure YARP to follow the redirection? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I was able to get a vertical slice of the app working using a HttpForwarder instead of the full Reverse Proxy. var builder = WebApplication.CreateBuilder(args);
builder.Services.AddHttpForwarder();
var app = builder.Build();
var httpClient = new HttpMessageInvoker(new SocketsHttpHandler()
{
UseProxy = false,
AllowAutoRedirect = true,
ConnectTimeout = TimeSpan.FromSeconds(30)
});
var transformer = HttpTransformer.Empty;
var requestOptions = new ForwarderRequestConfig();
app.MapForwarder("/{**catch-all}", "http://endpointhostname", requestOptions, transformer, httpClient);
app.Run(); Perhaps a Out of time for today, will update this thread if I make any further progress. |
Beta Was this translation helpful? Give feedback.
Your first example should have worked, it's doing essentially the same thing.