cap_mkt_tools cap_mkt_tools - 1 month ago 15
iOS Question

IOS device cannot connect to nginx hosted meteor app on digitalocean

I have a meteor app which is hosted on digitalocean but my ios mobile app cannot connect to the server on digitalocean. There is no error but I am not able to login which is an indication that it cannot connect.

So, here is the setup and the steps I take to test. I do not list version numbers as I think that I am doing something conceptually incorrect.

On DigitalOcean I run nginx. Here is the config file in /etc/nginx:

map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}

# HTTP
server {
listen 80;

location / {
rewrite ^ https://$server_name$request_uri? permanent;
}
}

# HTTPS server
server {
listen 443 ssl;

server_name pressit.capitalmarkettools.org;

ssl_certificate /etc/nginx/ssl/server.crt;
ssl_certificate_key /etc/nginx/ssl/server.key;

#...

location / {
proxy_pass http://127.0.0.1:3100;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; # allow websockets
proxy_set_header Connection $connection_upgrade;
proxy_set_header X-Forwarded-For $remote_addr; # preserve client IP
#....
}
}


Then, I run my meteor app with the following run script:

#!/bin/bash
export NODE_PATH=/usr/lib/nodejs:/usr/lib/node_modules:/usr/share/javascript
export BIND_IP=127.0.0.1
export PORT=3100
export HTTP_FORWARDED_COUNT=1
export MONGO_URL=mongodb://localhost:27017/pressit
export ROOT_URL=https://pressit.capitalmarkettools.org
export METEOR_SETTINGS='{ "somesetting": "someval", "public": { "othersetting": "anothervalue" } }'

cd /root/pressit/bundle
node /root/pressit/bundle/main.js > /root/log/pressit.log&


On DigitalOcean the Zone file is:

$ORIGIN pressit.capitalmarkettools.org.
$TTL 1800
pressit.capitalmarkettools.org. IN SOA ns1.digitalocean.com. hostmaster.pressit.capitalmarkettools.org. 1473473851 10800 3600 604800 1800
pressit.capitalmarkettools.org. 1800 IN NS ns1.digitalocean.com.
pressit.capitalmarkettools.org. 1800 IN NS ns2.digitalocean.com.
pressit.capitalmarkettools.org. 1800 IN NS ns3.digitalocean.com.
pressit.capitalmarkettools.org. 1800 IN A 67.205.136.200


So, the web site works on https://pressit.capitalmarkettools.org.

However, when I execute on my local development machine the following command the Simulator app cannot connect to the server machine (I tried them all).

meteor run ios --mobile-server https://pressit.capitalmarkettools.org:80
meteor run ios --mobile-server https://pressit.capitalmarkettools.org
meteor run ios --mobile-server https://67.205.136.200:3100
meteor run ios --mobile-server https://pressit.capitalmarkettools.org:3100


When I run meteor locally and run the Simulator against localhost:3000 it works all fine.

One more comment is that my ssl setup does not use a commercial certificate and when I connect the first time to https://pressit.capitalmarkettools.org the browser warns of a non secure connection.

Any help would be very much appreciated.

Answer

This issue was caused by not having a SSL certificate by a CA. By connecting safari to the device for debugging the error message stated the SSL was the issue and with letsencrypt I created a new SSL and not it works fine.

Comments