Can use IP address (with port, i.e: 204.48.21.23:3000) with postman to call API , but name (from A record) not working.

April 10, 2019 447 views
API DNS Ubuntu 18.04

So, I'm running an angular / spring boot app as containers on a droplet. For some reason, the localhost call through nginx isn't working ( getting ERR:CONNECTION_REFUSED). However, I was able to call it using my IP : PORT address. But since I need my webserver to make calls to an android app, I decided to set it up as a different droplet (I'm not sure if this is the best way or method, I'm new to all this). So, on cloudflare I have "kronologi.ca ---> ipv4" from digital ocean which serves my Web App. This works fine! I see my login page and what not.

Now, the issue is when I create a sub domain and point it to my second droplet with "api --> ipv4" and I call api.kronologi.ca:3000/rest/of/api/call , nothing works. Postman just hangs and the same applies everywhere else. However, calling IPv4:3000/rest/of/api/call works 100% fine. I'm not too sure what . I'm suppose to do or what I'm doing wrong. Is it a set up thing in my droplet?

1 Answer

Greetings!

Great question. You mentioned that you're using CloudFlare and that is likely where the issue comes in at. To use alternate ports behind CloudFlare you would need to disable their proxy. In their control panel this means disabling the orange cloud and waiting for DNS caches to hit TTL values (commonly referred to as DNS propagation, though a misleading term), then it would work. With their proxy enabled they do not pass alternate ports to your server, as their CDN IPs are shared. I do believe they will offer that service to you on their higher tier paid plans though.

Jarland

Have another answer? Share your knowledge.