I got a CORS problem I simply can't get my head around, hope someone can help me. Frontend is Angular 18. My backend .net core 8 Web API got a few endpoints, where not all works for some reason. Everything works as I expect on localhost, login etc. is butter smooth. But as soon as I publish the web api, only some of my endpoints works. https://tools.brokenholiday.online/audio-converter The endpoint for this component works as I expect and all is good. https://tools.brokenholiday.online/login Endpoint handling the login request returns Access to fetch at 'https://api.brokenholiday.online/authenticate/login' from origin 'https://tools.brokenholiday.online' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled My Program.cs builder.Services.AddScoped<JwtSecurityTokenHandlerWrapper>(); builder.Services.AddControllersWithViews(options => { options.Filters.Add(typeof(JwtAuthorizeFilter)); }); builder.Services.AddCors(options => { options.AddPolicy("AllowSpecificOrigin", builder => builder .WithOrigins("https://*.brokenholiday.online", "http://localhost:4200") .SetIsOriginAllowedToAllowWildcardSubdomains() .AllowAnyHeader() .AllowAnyMethod() .AllowCredentials()); }); builder.Services.AddControllers(); builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); var app = builder.Build(); app.UseMiddleware<JwtMiddleware>(); app.UseCors("AllowSpecificOrigin"); app.MapControllers(); app.UseHttpsRedirection(); app.UseAuthentication(); app.UseAuthorization(); app.Run(); Continue reading...