We use axios in the vue.js application to access the Azure function. We are getting this error right now:
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access.
We are trying to set the response headers in the function as follows:
context.res = { body: response.data, headers: { 'Access-Control-Allow-Credentials': 'true', 'Access-Control-Allow-Origin': 'http://localhost:8080', 'Access-Control-Allow-Methods': 'GET', 'Access-Control-Request-Headers': 'X-Custom-Header' } }
Does anyone encounter this error?
cors axios azure azure-functions
steverb
source share