I'm testing an Azure Functions app locally with the Azure Functions CLI tooling. Is there any way I can configure CORS settings for the local host?
To enable CORS support in Azure Functions is as simple as going to the CORS tab for your Function App in the portal and specifying the domains that are allowed to make calls to your Function.
Configure the cors policy in API Management for the following scenarios: Enable the interactive test console in the developer portal. Refer to the developer portal documentation for details. When you enable CORS for the interactive console, by default API Management configures the cors policy at the global scope.
The local. settings. json file is where you can define the values for your project in your developer environment.
You can configure CORS in the local settings file local.settings.json
:
{ "Values": { }, "Host": { "CORS": "*" } }
Settings in the
local.settings.json
file are used only when you're running projects locally
You can start the host like this
func host start --cors *
You can also be more specific and provide a comma delimited list of allowed urls
More here: https://github.com/Azure/azure-webjobs-sdk-script/issues/1012
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With