I have a Meteor app which runs on a local server for developement (http://10.0.2.10:3000). The ROOT_URL
is set correctly so __meteor_runtime_config__.ROOT_URL
equals this URL. Of course the app is working perfectly fine in the browser on a client computer within 10.0.2.0/24. The app is also working fine on mobile chrome/firefox on my android cell phone which is also part of 10.0.2.0/24. However when I try to run it as app on this cell phone with meteor run android-device --mobile-server http://10.0.2.10:3000/
something strange happens:
When the app starts for the first time (or the first time after I clear all app data) it works like it should (content from the DB is loaded) for a few short seconds. Then the app reloads and any remote content from the DB isn't loaded anymore. I have added the following function to see where Meteor tries to connect to:
Meteor.startup(function(){
console.log(__meteor_runtime_config__.ROOT_URL);
})
The first time when remote content is loaded this returns http://10.0.2.10:3000/ like I would expect. The second time when remote content isn't loaded it returns http://10.0.2.2:3000/.
The question now is, why is Meteor/Cordova doing this and how can I stop this behavior? Because obviously I cannot test the app this way. I'm not yet sure if it would work in production when I have a FQDN and HTTPS proxy but that's beyond the point.
I tried to find 10.0.2.2 as nothing in my LAN is running there and I have not specified this IP anywhere and found it in /cordova-build/www/application/index.html
which seems to be generated from boilerplate_web.cordova.html
(see this link https://searchcode.com/codesearch/view/91819963/). However Meteor offers the possibility to override these generated files with a folder cordova-build-override
and so I did removing the whole
if (/Android/i.test(navigator.userAgent)) {
//[...]
}
block and added a short console.log('removed')
. This gets called so I know the override was successful and when I grep through the whole built .apk file 10.0.2.2 isn't found anymore - still the behavior is the same.
Any ideas what's going on and what to do?