From 806c0eaf760fc0026ea00de415d16944844988a8 Mon Sep 17 00:00:00 2001 From: Simple_Not <44047940+moonbaseDelta@users.noreply.github.com> Date: Thu, 20 Oct 2022 11:17:03 +1000 Subject: [PATCH] cors --- Program.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Program.cs b/Program.cs index 5d44d5a..cfdbabc 100644 --- a/Program.cs +++ b/Program.cs @@ -5,6 +5,16 @@ var builder = WebApplication.CreateBuilder(args); builder.Services.AddControllers(); // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle builder.Services.AddEndpointsApiExplorer(); + + +builder.Services.AddCors(setup => +{ + setup.AddDefaultPolicy(policyBuilder => + { + policyBuilder.WithOrigins("http://www.vdk2ch.ru:4200"); + }); + +}); //builder.Services.AddSwaggerGen(); var app = builder.Build(); @@ -18,6 +28,8 @@ if (app.Environment.IsDevelopment()) //app.UseHttpsRedirection(); +app.UseCors(); + app.UseAuthorization(); app.MapControllers();