refactor: remove blog CORS policy from principal project

This commit is contained in:
Oliver Booth 2023-08-13 13:11:50 +01:00
parent f60b9c754a
commit bd5fd6114a
Signed by: oliverbooth
GPG Key ID: B89D139977693FED

View File

@ -32,11 +32,6 @@ builder.Services.AddSingleton(provider => new MarkdownPipelineBuilder()
builder.Services.AddDbContextFactory<WebContext>(); builder.Services.AddDbContextFactory<WebContext>();
builder.Services.AddRazorPages().AddRazorRuntimeCompilation(); builder.Services.AddRazorPages().AddRazorRuntimeCompilation();
builder.Services.AddControllersWithViews(); builder.Services.AddControllersWithViews();
builder.Services.AddCors(options => options.AddPolicy("BlogApi", policy => (builder.Environment.IsDevelopment()
? policy.AllowAnyOrigin()
: policy.WithOrigins("https://oliverbooth.dev"))
.AllowAnyMethod()
.AllowAnyHeader()));
builder.Services.AddRouting(options => options.LowercaseUrls = true); builder.Services.AddRouting(options => options.LowercaseUrls = true);
builder.WebHost.AddCertificateFromEnvironment(2845, 5049); builder.WebHost.AddCertificateFromEnvironment(2845, 5049);
@ -54,7 +49,6 @@ app.UseHttpsRedirection();
app.UseStaticFiles(); app.UseStaticFiles();
app.UseRouting(); app.UseRouting();
app.UseAuthorization(); app.UseAuthorization();
app.UseCors("BlogApi");
app.MapControllers(); app.MapControllers();
app.MapRazorPages(); app.MapRazorPages();