CORS in Meteor with Cordova
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
add a comment |
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
add a comment |
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
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
cordova meteor cors
edited Nov 6 '18 at 21:26
user3819370
asked Nov 6 '18 at 21:08
user3819370user3819370
170213
170213
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Wow, I forgot the port (:3000) in the http-address for the root and mobile-server like so:
http://localhost:3000
:)
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Wow, I forgot the port (:3000) in the http-address for the root and mobile-server like so:
http://localhost:3000
:)
add a comment |
Wow, I forgot the port (:3000) in the http-address for the root and mobile-server like so:
http://localhost:3000
:)
add a comment |
Wow, I forgot the port (:3000) in the http-address for the root and mobile-server like so:
http://localhost:3000
:)
Wow, I forgot the port (:3000) in the http-address for the root and mobile-server like so:
http://localhost:3000
:)
answered Nov 19 '18 at 20:43
user3819370user3819370
170213
170213
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
