I\'m making an Ajax.request to a remote PHP server in a Sencha Touch 2 application (wrapped in PhoneGap).
Ajax.request
The response from the server is the following:
When you receive the request you can
var origin = (req.headers.origin || "*");
than when you have to response go with something like that:
res.writeHead( 206, { 'Access-Control-Allow-Credentials': true, 'Access-Control-Allow-Origin': origin, } );