Why doesn't "http://my_ip_address:port" work on my droplet?

Hi, I created a simple http node app for testing, but I can’t get it to work on my droplet. The code is the sample code from

var http = require(‘http’); http.createServer(function (req, res) { res.writeHead(200, {‘Content-Type’: ‘text/plain’}); res.end(‘Hello World\n’); }).listen(1337, ‘’); console.log(‘Server running at’);

The node app runs, but when I hit “http://my_ip_address:1337” I get no result.

I have a domain name connected to my droplet, and are wondering if that is the reason I can’t connect. I tested this on a fresh droplet aswell, and its working as expected.

PS: If i listen on port 80 instead, in the node app, it works.

Why can’t I use any other ports, any suggestions?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Great! Glad to hear you got it working.

Update** <br>Answer: I was trying to set this up on a droplet created from the pre-made Ghost image by DO. Finally figured out that this image comes with some rules already applied to IPTABLES. That was the reason I couldn’t reach my node app on a random port number. Added a rule to IPTABLES, and everything is working as expected.

Update, I’m using IP address “” in the node app, and netstat shows ip and port number. Still no success =/