Is it possible to use the client-side proxy provided by the Canvas SDK from a canvas app embedded within a Visualforce page to access an Apex REST endpoint?
We have a canvas app which calls an Apex REST endpoint
Sfdc.canvas.client.ajax('/services/apexrest/myapp/myservice', {
client: Sfdc._sr.client,
success: myCallback
});
This works correctly when the canvas app is loaded from the chatter tab; both the chatter page and the API are on the same domain, na7.salesforce.com
, for example.
But when the canvas app is embedded in a Visualforce page, it doesn't work because the Visualforce page is on myapp.na7.visual.force.com
, and the client-side proxy sends the request to na7.salesforce.com
, causing a cross-origin error.
Any suggestions on making this work?
It would be great if the client-side proxy transparently made use of ajax proxy on the Visualforce domain.