I have a Meteor 1.8.0.2 app with web cordova Android & iOS Apps. I used to move the app to play store mentioning the port in the create build statement.
meteor run android-device --mobile-server="http://www.sitename.com:3000"
But now, Every build is getting rejected because https not mentioned in the mobile server.
While Changing the mobile server to –mobile-server="http://www.sitename.com
Getting this as errror.
Access to XMLHttpRequest at 'https://www.sitename.com/sockjs/info?cb=imah9cuyow' from origin 'http://localhost:12160' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains multiple values 'http://localhost:12160, *', but only one is allowed.", source: http://localhost:12160/cookies (0)
Tried Things:
Tried these things to solve this:
Meteor.startup(function() {
console.log('Configuring content-security-policy:');
BrowserPolicy.content.allowSameOriginForAll();
BrowserPolicy.content.allowOriginForAll("http://meteor.local");
BrowserPolicy.content.allowOriginForAll('https://www.specialneighborhood.com');
BrowserPolicy.content.allowEval();
BrowserPolicy.framing.disallow();
});
WebApp.rawConnectHandlers.use(function(req, res, next) {
res.setHeader("Access-Control-Allow-Origin", "*");
res.setHeader("Access-Control-Allow-Headers", "Authorization,Content-Type");
return next();
});
But no solution found.
Server configuration:
- Mup Js Used for Deployment
- NGINX
Also attaching the code for mup.js
module.exports = {
servers: {
one: {
host: 'sitename.com',
username: 'ubuntu',
pem:'~/new_pair.pem'
// password:
// or leave blank for authenticate from ssh-agent
}
},
meteor: {
name: 'special',
path: '../../special',
volumes: {
'/var/www/html/uploading_server/files/': '/var/www/html/uploading_server/files/'
},
servers: {
one: {}
},
buildOptions: {
serverOnly: true,
},
env:{
ROOT_URL: 'http://sitename.com',
PORT:3000,
MONGO_URL: 'mongodb://localhost/meteor'
},
dockerImage: 'abernix/meteord:node-8.4.0-base',
deployCheckWaitTime: 60,
enableUploadProgressBar: true,
},
mongo: {
oplog: true,
port: 27017,
servers: {
one: {},
},
},
};
Let me know what’s missing and needs to be changed. Any help would be appreciated.
Thanks