Add Cors handling to Blazor UI
This commit is contained in:
@@ -40,7 +40,17 @@ namespace MarketDataServer
|
||||
config.ResolveConflictingActions (apiDescriptions => apiDescriptions.First ());
|
||||
});
|
||||
|
||||
builder.Services.AddCors(options =>
|
||||
{
|
||||
options.AddPolicy("corsPolicy",
|
||||
builder =>
|
||||
{
|
||||
builder.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod().SetIsOriginAllowedToAllowWildcardSubdomains();
|
||||
});
|
||||
});
|
||||
|
||||
WebApplication webApplication = builder.Build();
|
||||
webApplication.UseCors("corsPolicy");
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (webApplication.Environment.IsDevelopment()||webApplication.Environment.IsProduction() )
|
||||
|
||||
Reference in New Issue
Block a user