CORS in Meteor with Cordova












2














I am ridiculously trying to get CORS working on Meteor 1.8, suddenly had this problem in my app:



" I chromium: [INFO:CONSOLE(0)] "Access to XMLHttpRequest at 'http://192.168.1.14/sockjs/info?cb=3lc2_ftamu' from origin 'http://localhost:12368' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.", source: http://localhost:12368/ (0)"



It only appears on Android and iOS, not when running web-only.



I searched all the stack overflow and Meteor help and forums, tried:



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


Also tried in mobile_config.js:



App.accessRule('*');


I also tried other headers on the server, updated Meteor, tried with the cors package:



...
WebApp.connectHandlers.use(cors(corsOptions));


and all the other common things when Meteor Cordova isn't running.



Any idea?










share|improve this question





























    2














    I am ridiculously trying to get CORS working on Meteor 1.8, suddenly had this problem in my app:



    " I chromium: [INFO:CONSOLE(0)] "Access to XMLHttpRequest at 'http://192.168.1.14/sockjs/info?cb=3lc2_ftamu' from origin 'http://localhost:12368' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.", source: http://localhost:12368/ (0)"



    It only appears on Android and iOS, not when running web-only.



    I searched all the stack overflow and Meteor help and forums, tried:



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


    Also tried in mobile_config.js:



    App.accessRule('*');


    I also tried other headers on the server, updated Meteor, tried with the cors package:



    ...
    WebApp.connectHandlers.use(cors(corsOptions));


    and all the other common things when Meteor Cordova isn't running.



    Any idea?










    share|improve this question



























      2












      2








      2







      I am ridiculously trying to get CORS working on Meteor 1.8, suddenly had this problem in my app:



      " I chromium: [INFO:CONSOLE(0)] "Access to XMLHttpRequest at 'http://192.168.1.14/sockjs/info?cb=3lc2_ftamu' from origin 'http://localhost:12368' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.", source: http://localhost:12368/ (0)"



      It only appears on Android and iOS, not when running web-only.



      I searched all the stack overflow and Meteor help and forums, tried:



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


      Also tried in mobile_config.js:



      App.accessRule('*');


      I also tried other headers on the server, updated Meteor, tried with the cors package:



      ...
      WebApp.connectHandlers.use(cors(corsOptions));


      and all the other common things when Meteor Cordova isn't running.



      Any idea?










      share|improve this question















      I am ridiculously trying to get CORS working on Meteor 1.8, suddenly had this problem in my app:



      " I chromium: [INFO:CONSOLE(0)] "Access to XMLHttpRequest at 'http://192.168.1.14/sockjs/info?cb=3lc2_ftamu' from origin 'http://localhost:12368' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.", source: http://localhost:12368/ (0)"



      It only appears on Android and iOS, not when running web-only.



      I searched all the stack overflow and Meteor help and forums, tried:



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


      Also tried in mobile_config.js:



      App.accessRule('*');


      I also tried other headers on the server, updated Meteor, tried with the cors package:



      ...
      WebApp.connectHandlers.use(cors(corsOptions));


      and all the other common things when Meteor Cordova isn't running.



      Any idea?







      cordova meteor cors






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 6 '18 at 21:26







      user3819370

















      asked Nov 6 '18 at 21:08









      user3819370user3819370

      170213




      170213
























          1 Answer
          1






          active

          oldest

          votes


















          0














          Wow, I forgot the port (:3000) in the http-address for the root and mobile-server like so:



          http://localhost:3000



          :)






          share|improve this answer





















            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53180025%2fcors-in-meteor-with-cordova%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Wow, I forgot the port (:3000) in the http-address for the root and mobile-server like so:



            http://localhost:3000



            :)






            share|improve this answer


























              0














              Wow, I forgot the port (:3000) in the http-address for the root and mobile-server like so:



              http://localhost:3000



              :)






              share|improve this answer
























                0












                0








                0






                Wow, I forgot the port (:3000) in the http-address for the root and mobile-server like so:



                http://localhost:3000



                :)






                share|improve this answer












                Wow, I forgot the port (:3000) in the http-address for the root and mobile-server like so:



                http://localhost:3000



                :)







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 19 '18 at 20:43









                user3819370user3819370

                170213




                170213






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53180025%2fcors-in-meteor-with-cordova%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    The term 'EXEC' is not recognized as the name of a cmdlet Powershell

                    NPM command prompt closes immediately [closed]

                    Error binding properties and functions in emscripten