Origin is not allowed by Access-Control-Allow-Origin on mobile (despite adding the Access-Control-Allow-Origin' *" header in nginx server)


I cant retrieve information from my remote database because I keep getting this error: “[Error] Origin http://localhost:12648 is not allowed by Access-Control-Allow-Origin.”

This is what my server settings look like on nginx:

server {
listen 80;
server_name IP_ADDRESS;

location / {
    add_header 'Access-Control-Allow-Origin' *;
    add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';

# Tell Nginx and Passenger where your app's 'public' directory is
root /var/www/appname/bundle/public;
#root /usr/share/nginx/html;

# Turn on Passenger
passenger_enabled on;
# Tell Passenger that your app is a Meteor app
passenger_app_type node;
passenger_startup_file main.js;

# Tell your app where MongoDB is
passenger_env_var MONGO_URL mongodb://localhost:27017/meteor;
# Tell your app what its root URL is
passenger_env_var ROOT_URL http://IP_ADDRESS;


I’ve also added a mobile-config.js file with:


but nothing works.