Option 1: In Azure Portal

Cross-Origin Resource Sharing (CORS) allows JavaScript code running in a browser on an external host to interact with your backend. Specify the origins that should be allowed to make cross-origin calls (for example: http://example.com:12345). To allow all, use “*” and remove all other origins from the list. Slashes are not allowed as part of domain or after TLD. Learn more

Go to your Azure Function -> API -> CORS

Added “*” to Allowed Origins.

Option 2: In our Function Project

local.settings.json

{
  "Host": {
    "CORS": "*"
  }
}

Sources:

https://www.c-sharpcorner.com/article/handling-cors-in-azure-function/

https://stackoverflow.com/questions/43767255/cors-with-azure-function-from-localhost-not-cli

Last modified: March 30, 2021

Author

Comments

Write a Reply or Comment