Develop/C#

[C#] ASP.NET API Cors 전체 허용

Codit Develop 2022. 3. 22. 16:50
반응형

ASP.NET API Cors 허용

UseCors 설정

http, https 허용

# Program.cs
var app = builder.Build();

app.UseCors(x =>
{
    x.AllowAnyHeader().
    AllowAnyMethod().
    AllowAnyOrigin().
    SetIsOriginAllowed(origin => true).
    WithOrigins("http://*").
    WithOrigins("https://*").
    AllowCredentials();
});
반응형