mirror of
https://github.com/SoPat712/allstarr.git
synced 2026-02-10 07:58:39 -05:00
Fix HTTP 307 redirect handling: configure HttpClient to follow redirects
This commit is contained in:
@@ -11,6 +11,7 @@ using allstarr.Services.Common;
|
|||||||
using allstarr.Services.Lyrics;
|
using allstarr.Services.Lyrics;
|
||||||
using allstarr.Middleware;
|
using allstarr.Middleware;
|
||||||
using allstarr.Filters;
|
using allstarr.Filters;
|
||||||
|
using Microsoft.Extensions.Http;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
@@ -55,6 +56,17 @@ builder.Services.AddControllers()
|
|||||||
});
|
});
|
||||||
|
|
||||||
builder.Services.AddHttpClient();
|
builder.Services.AddHttpClient();
|
||||||
|
builder.Services.ConfigureAll<HttpClientFactoryOptions>(options =>
|
||||||
|
{
|
||||||
|
options.HttpMessageHandlerBuilderActions.Add(builder =>
|
||||||
|
{
|
||||||
|
builder.PrimaryHandler = new HttpClientHandler
|
||||||
|
{
|
||||||
|
AllowAutoRedirect = true,
|
||||||
|
MaxAutomaticRedirections = 5
|
||||||
|
};
|
||||||
|
});
|
||||||
|
});
|
||||||
builder.Services.AddEndpointsApiExplorer();
|
builder.Services.AddEndpointsApiExplorer();
|
||||||
builder.Services.AddSwaggerGen();
|
builder.Services.AddSwaggerGen();
|
||||||
builder.Services.AddHttpContextAccessor();
|
builder.Services.AddHttpContextAccessor();
|
||||||
|
|||||||
Reference in New Issue
Block a user