+ Start a Discussion
basil rakawibasil rakawi 

REST API from *.force.com site

When invoking the chatter REST API from a force.com page I get:

https://*.ap1.force.com is not allowed by Access-Control-Allow-Origin.


How do I add my force.com site to the allow list?


Basil Rakawi


Are you running into the Single Origin Policy here? If so, Salesforce has an Ajax proxy you can use to tunnel your callout through the Salesforce server, it's doc'd halfway down this page: http://www.salesforce.com/us/developer/docs/ajax/Content/sforce_api_ajax_queryresultiterator.htm


There is also a whitelist of sites that your pages are allowed to call out to, which you can access in Setup, under Remote Site Settings: http://login.salesforce.com/help/doc/en/configuring_remoteproxy.htm