[Help Needed] Using the YARP as HTTP forwarder for https url requests #1637
-
Team, app.UseEndpoints(endpoints =>
{
endpoints.Map("/{**catch-all}", async httpContext =>
{
try
{
var prefix = httpContext.Request.IsHttps ? "https://" : "http://";
var destinationAddress = prefix + httpContext.Request.Host;
var error = await forwarder.SendAsync(httpContext, destinationAddress,
httpClient, requestConfig, transformer);
// Check if the operation was successful
if (error != ForwarderError.None)
{
var errorFeature = httpContext.GetForwarderErrorFeature();
var exception = errorFeature.Exception;
}
}
catch (Exception e)
{
Console.WriteLine(e);
}
});
}); |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Did you configure an endpoint for https like here https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel/endpoints?view=aspnetcore-6.0#configureiconfiguration ? |
Beta Was this translation helpful? Give feedback.
Did you configure an endpoint for https like here https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel/endpoints?view=aspnetcore-6.0#configureiconfiguration ?