Whenever I try to run with
android-device I get the following message.
(android:http://meteor.local/:0) XMLHttpRequest cannot load http://192.168.20.41:3000/sockjs/info?cb=iwwtnymjz7. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://meteor.local' is therefore not allowed access. The response had HTTP status code 403.
I’ve googled around quite a bit but I’m not getting anywhere, anyone got a definitive answer on how to get this going? I thought this would work out of the box.
This really is driving me mad, I’ve tried everything I think of, I’m hoping its something silly and easy to solve. Would love to know how anyone else is doing this.
I’m not sure why connecting to the socksjs endpoint would result in a 403 response.
Can you try looking at the Chrome remote debugger (through
chrome://inspect) to see if there are any other errors?
This has to do with Android not having permission to connect to the local server, I’ve also discovered that with Android 4.4+ this needs to be set with CSP, as per the cordova docs so using on the addAcessRule in the mobile-config.json wasn’t doing the trick. I’ve just got it working but have some peripheral code to clean up before I post the solution, using browser-pollicy and the mobile-config combined.
Thanks for the input, and you’re absolutely right, I should’ve opened up inspect a while ago, cheers.
I’ll post my final solution shortly.
Ah, glad you found it out! In the Meteor 1.3 release, we include a default permissive CSP meta tag by default. We probably won’t get to it for 1.3, but the idea is that in the future we would use the permissions set using
browser-policy (the same ones that we sue to set the CSP header) to generate the meta tag.
awesome. I’m looking forward to 1.3, Though it seems I’ve now broken it in the browser somehow (lol) . I will have this beat, eventually.
Okay, now i really don’t know what going on. I have removed all the access rules I added to my mobile-config, as the browser policies and package, removing the app from the deivce as well. Still it NOW, just works? Black magic? - I think not, there’s something odd here.
Even after clearing this out, could it be cahced somehow?
okay after almost three weeks of trying to replicate this I can’t force it. I all but gave up and had it happen again today, out of the blue. A quick app reload and its gone. My assumption now is that its a device / setup issue of some kind. Until I can replicate it reliably I’m going to leave it alone.