CORS with Azure function from localhost (not CLI)
CORS with Azure function from localhost (not CLI)
CORS with Azure function from localhost (not CLI)
Re: CORS with Azure function from localhost (not CLI)
To set CORS working locally when you are not using CLI and you are using Visual Studio/ VS Code - you need to add local.settings.json file into your project if it's not there.
Make sure "Copy to output directly" set to "copy if newer"
[](https://i.sstatic.net/AhoEM.png)
Then in your "local.settings.json" you can add `CORS": "*"` like so:
```
{
"IsEncrypted": false,
"Values": {
},
"Host": {
"LocalHttpPort": 7071,
"CORS": "*"
}
}
```
More info:
[https://learn.microsoft.com/en-us/azure/azure-functions/functions-run-local](https://learn.microsoft.com/en-us/azure/azure-functions/functions-run-local)
Make sure "Copy to output directly" set to "copy if newer"
[](https://i.sstatic.net/AhoEM.png)
Then in your "local.settings.json" you can add `CORS": "*"` like so:
```
{
"IsEncrypted": false,
"Values": {
},
"Host": {
"LocalHttpPort": 7071,
"CORS": "*"
}
}
```
More info:
[https://learn.microsoft.com/en-us/azure/azure-functions/functions-run-local](https://learn.microsoft.com/en-us/azure/azure-functions/functions-run-local)