cors
This commit is contained in:
@@ -35,15 +35,21 @@ var options = new WebApplicationOptions
|
|||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(options);
|
var builder = WebApplication.CreateBuilder(options);
|
||||||
|
|
||||||
|
var allowedOrigins = new string[]
|
||||||
|
{
|
||||||
|
"https://webshop.tzbre.dev",
|
||||||
|
"http://localhost:4200"
|
||||||
|
};
|
||||||
|
|
||||||
builder.Services.AddCors(options =>
|
builder.Services.AddCors(options =>
|
||||||
{
|
{
|
||||||
options.AddPolicy("AllowNuxtApp",
|
options.AddPolicy(name: "AllowSpecificOrigins",
|
||||||
policy =>
|
policy =>
|
||||||
{
|
{
|
||||||
policy.WithOrigins("http://localhost:3000")
|
policy.WithOrigins(allowedOrigins)
|
||||||
.AllowAnyHeader()
|
.AllowAnyHeader()
|
||||||
.AllowAnyMethod();
|
.AllowAnyMethod();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// --- 1. Dependency Injection Konfiguration ---
|
// --- 1. Dependency Injection Konfiguration ---
|
||||||
@@ -300,8 +306,8 @@ app.UseStaticFiles();
|
|||||||
// Swagger/SwaggerUI f<>r API-Dokumentation aktivieren
|
// Swagger/SwaggerUI f<>r API-Dokumentation aktivieren
|
||||||
//'if (app.Environment.IsDevelopment())
|
//'if (app.Environment.IsDevelopment())
|
||||||
//{
|
//{
|
||||||
app.UseSwagger();
|
app.UseSwagger();
|
||||||
app.UseSwaggerUI();
|
app.UseSwaggerUI();
|
||||||
//}
|
//}
|
||||||
|
|
||||||
// app.UseHttpsRedirection(); // Auskommentiert f<>r Docker HTTP-Entwicklung
|
// app.UseHttpsRedirection(); // Auskommentiert f<>r Docker HTTP-Entwicklung
|
||||||
|
|||||||
Reference in New Issue
Block a user