Live Chat Icon For mobile
Live Chat Icon

How do you fix “The CORS protocol does not allow specifying a wildcard (any) origin and credentials at the same time” error in Blazor Server application?

Platform: Blazor| Category : Error handling, Troubleshooting

In a Blazor Server application, if you want to use both AllowCredentials() and AllowAnyOrigin() with respect to CORS settings, then add SetIsOriginAllowed(Func<string,bool> predicate) under ConfigureServices in the Startup.cs file instead of using AllowAnyOrigin(). See the following code snippet. 


public void ConfigureServices(IServiceCollection services) 




        services.AddCors(options => 


        options.AddPolicy("Open", builder => 

        builder.SetIsOriginAllowed(_ => true). 






Refer to this link for more information. 

Share with