I'm setting up an API through OpenWhisk with multiple endpoints:
for my POST /jobs/create endpoint, I am getting CORS errors:
Access to XMLHttpRequest at 'https://runtime.adobe.io/apis/****/privacy/jobs/create' from origin 'https://requestdomain.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
I can access the endpoint with Postman just fine. To test if it was just a nested endpoint issue, I created a GET /jobs/create endpoint (same endpoint, different method), and am receiving 0 errors accessing directly from the browser. The only difference is that my POST /jobs/create endpoint points to a zip action. My GET /jobs/create does not.
Is there something I'm missing in my zip action?
I've added access-control headers to my return:
return {
headers: {
'Access-Control-Allow-Origin':'*',
'Content-Type':'application/json'
},
statusCode: 200,
body: {
jobIds: privacy_jobIds
}
};
What am I doing wrong here? I can access every other endpoint on the /privacy API just fine.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Hello there,
We've updated the docs to cover this topic: https://github.com/AdobeDocs/adobeio-runtime/blob/master/guides/creating_rest_apis.md#enable-cors-on...
thank you,
Mihai
Views
Replies
Total Likes