Meteor run android-device --mobile-server myapp.com --verbose gives XMLHttpRequest cannot load http://myapp.com/sockjs/info?cb=bgnptnrcqn. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://meteor.local' is


#1

When I try to run:

meteor run android-device --mobile-server http://myapp.com --production --verbose

I never get connected (the dreaded “connecting”…“waiting” in Meteor.status), and the verbose output gives:

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

Several hours of googling similar problems hasn’t led me to any solution (not to mention I’ve been trying to get this working for days). Anybody have any ideas? I’m building on Ubuntu 14.04, running Android 4.4 Samsung Galaxy Prevail, and my server (DigitalOcean droplet) is using nginx proxy, nginx 1.8.0.

I am deploying with mup, and this environment setup currently:

 "env": {
    "DDP_DEFAULT_CONNECTION_URL": "http://myapp.com",
    "ROOT_URL": "http://myapp.com",
    "MONGO_URL": "mongodb://localhost:27017/meteor",
    "UPSTART_UID": "mylinuxuser" // The user you want to run meteor as.
  },

Most recently I tried adding to my nginx config, similar to mato75’s comment here, with no luck: https://gist.github.com/michiel/1064640

Any ideas? Is there anybody out there at all that is running an app on an android device and connecting to a public server, with similar setup??

TIA,
Chris


#2

I finally got this connected, but I’ve tried so many variations that I want to be clear myself on what exactly finally did work (because of the time it takes to re-deploy and re-launch the app I wasn’t always perfect about only changing one thing at a time) and for that I will have to return to this later.


#3

@chrisco23 - what steps ended up working for you?

I’m using mup with an ssl certificate configuration, wondering if that is what’s breaking it…


#4

Sorry I have not yet gotten to SSL for my project and I’m still not entirely sure what I gave days out of my life to, but one of the last things I did was remove the UPSTART_UID bit that I found suggested somewhere.

Are you having the same symptoms?

My env now looks like:

"MONGO_URL": "mongodb://localhost:27017/m-staging-etfinvest-com",
"PORT": 3001,
"ROOT_URL": "http://localhost"

I use nginx proxy and I’m trying to be able to run two meteor apps on one humble digital ocean server, without conflict.


#5

The --mobile-server flag tripped me up, it’s --server when meteor build-ing

meter help run and meteor help build seemed inconsistent, until I read the whole paragraph description for --mobile-server and --server respectively.

Managed to get the SSL config to work with mup; same config fails for unknown reasons with mupx (active development). To get it working, it’s mostly making sure the keys are concatenated in the right order as per @arunoda’s instructions


#6

I’ve never tried the “meteor build” before. I thought that was only for people who are not using mup??

[edit] I did finally get connected. There were a great many snags and it cost no small amount of the weekend to overcome them all. A good blog post and/or thorough documentation on these things is warranted. I’ll try to do my part. One of the final pieces for me was Slava Kim’s post about the browser-policy package: https://github.com/meteor/meteor/issues/4132