I have a requirement where I need to call my custom written Apex REST api from java-script in visualforce page, But somehow I'm getting that CORS issue which says my request has been blocked due to following error:
No
'Access-Control-Allow-Origin'
header is present on the requested resource
I know now it shouldn't throw any kind of CORS issue, because as per summer 16 release CORS is supported by Apex REST service, refer below post: https://releasenotes.docs.salesforce.com/en-us/summer16/release-notes/rn_apex_rest_cors.htm
And I already added request origin url (which is VF) in the CORS settings, Setup >> CORS
Second weird thing is it always show me GET call in the dev console, although I'm making a POST call in the API, may be it because of any redirection behavior. Please find error screenshot from my dev console.
Can anyone suggests what's gone wrong here.