AnsweredAssumed Answered

CORS issue while invoking custom endpoint

Question asked by kkaus on Oct 14, 2017
Latest reply on Dec 10, 2018 by Stephen_Hughes

I am able to hit the other endpoints which are for resources/tables from the javascript code of my application from ajax but when I am trying to hit the custom endpoint I am getting the below error in the browser console.


Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.


I got some solutions to send below in response header but It didn't work

responseHeaders.put('Access-Control-Allow-Origin', '*');


do we need to do something for the custom endpoint to make it accessible from the localhost?


Please give your thoughts else I have to move my code to the functions from the custom endpoints.