CORS: Azure Functions and Blazor

Error:

Access to fetch at 'http://localhost:7071/api/' from origin 'https://localhost:44361' 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.

For v3+ the following works:

p.s. note that location of Hosts is on the same level as Values and not under it

Configure CORS in the local settings file local.settings.json:

{
  "Values": {
  },
  "Host": {
    "CORS": "*"
  }
}

If it worked for you, please vote it up on: https://stackoverflow.com/a/60109518/2705777

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*