Base solution for your next web application
Open Closed

Disable Cross Origin Resource Sharing #10244


User avatar
0
andry3ag created

Hi Team,

We have recently downloaded the ASP.Net Core 3x with Angular 9.x (version 8.6). I can see from documentation to add URL to the "CorsOrigins" on the appsetting.json. Is there a way to disable Cors Origins all together? Or maybe use wildcards? Should I just replace all the URls under the "CorsOrigins" on appsetting.json with "*"? Would that work? If not how can i disable the Cors Origins?

Thanks


1 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @andry3ag

    You can use wildcards in CorsOrigins values as shown below;

    "CorsOrigins": "http://*.mycompany.com,http://localhost:4200,http://localhost:9876",
    

    Does this work for you ? If not, could you explain why do you want to disable it ? Do you want to allow all websites to access your API or vice versa ?