URGENT : Request was denied for security Andorid 8.0 Meteor Cordova

#1

Hi Everyone,

I am having an issue with Android App. It was working fine as it was on https. but now on https, it’s having issue getting Request was denied for security message every time I open the app and it’s not functional too.

Also, tried with HTTP as I have configured NGINX on my Server. Now getting an error as

XMLHttpRequest cannot load http://www.websiteName.com/sockjs/info?cb=zonfsrtd7w. No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://localhost:12240’ is therefore not allowed access.", source: http://localhost:12240/

this is the configuration file for NGINX

server {
    listen 0.0.0.0:80;
    server_name websitename.com www.websitename.com;
    return 301 https://www.websitename.com$request_uri;
}

# optional - listen to a www. request and strip out the www.
server {
      listen 80;
     server_name websitename.com www.websitename.com;
  return 301 $scheme://www.websitename.com$request_uri;
}

# after the request has been forwarded to an ssl domain
# listen on port 443 and turn ssl sockets on
server {
      listen 443;
      # --
      # this could be your IP address, a subdomain or a full domain
      # --
      server_name websitename.com www.websitename.com;

      # --
      # the location of your letsencrypt certificates
      # --
      ssl_certificate /etc/letsencrypt/live/www.websitename.com/fullchain.pem;
      ssl_certificate_key /etc/letsencrypt/live/www.websitename.com/privkey.pem;
      ssl on;
      access_log /var/log/nginx/access.plygrid.log;
      error_log /var/log/nginx/error.plygrid.log;
      location / {
            proxy_pass http://localhost:3000;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection 'upgrade';
            proxy_set_header X-Forwarded-For $remote_addr;


 if ($request_method = 'OPTIONS') {
        add_header 'Access-Control-Allow-Origin' '*';
        add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
        #
        # Custom headers and headers various browsers *should* be OK with but aren't
        #
        add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
        #
        # Tell client that this pre-flight info is valid for 20 days
        #
        add_header 'Access-Control-Max-Age' 1728000;
        add_header 'Content-Type' 'text/plain; charset=utf-8';
        add_header 'Content-Length' 0;
        return 204;
     }
     if ($request_method = 'POST') {
        add_header 'Access-Control-Allow-Origin' '*';
        add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
        add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
        add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
     }
     if ($request_method = 'GET') {
        add_header 'Access-Control-Allow-Origin' '*';
        add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
        add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
        add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
     }

    }

}



Also, added this,


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

it’s not working. Is there anyone else experienced this issue. Please help it’s very urgent as the app stopped working and it’s live.

#2

Using this command works for me (After the paid SSL version)

– meteor build build_diretory --server=“http://example.com:3000

Do Specify the port no. if you haven’t.