Can't connect android app to server, CORS policy error


#1

Hi,

I am trying to run an android app but it can’t connect to the server. On the client I have the following error:

XMLHttpRequest cannot load http://www.myapp.com/sockjs/info?cb=0ybkxxnsl8. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:12880' is therefore not allowed access

I don’t know why http://localhost:12880

I am using galaxy and the URL is www.myapp.com.

Command used :
meteor run android-device --settings settings.json --mobile-server www.myapp.com

On my server, i’ve :

  WebApp.rawConnectHandlers.use(function(req, res, next) {
    res.setHeader("Access-Control-Allow-Origin", "*");
    return next();
  });

On my mobile-config.js :

App.accessRule("*");

Any help would be appreciated!


#2

No one on this ? :grin: