Web: Update CORS policy

This commit is contained in:
genteure 2022-06-09 16:04:29 +08:00
parent 042657be3e
commit dc475681c1

View File

@ -62,8 +62,17 @@ namespace BililiveRecorder.Web
services
.AddAutoMapper(c => c.AddProfile<DataMappingProfile>())
.AddCors(o => o.AddDefaultPolicy(p => p.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader()))
;
.AddCors(o => o.AddDefaultPolicy(policy =>
{
policy
.SetIsOriginAllowed(origin => true)
.AllowAnyMethod()
.AllowAnyHeader()
.AllowCredentials()
.WithExposedHeaders("Content-Length")
.SetPreflightMaxAge(TimeSpan.FromMinutes(5))
;
}));
services.AddSingleton(new ManifestEmbeddedFileProvider(typeof(Startup).Assembly));