Couldn't fetch api while firewall is enabled.

Posted October 5, 2020 505 views
Node.jsAPIFirewallLet's Encrypt


I have a website on digitalocean and I just followed the tutorial down below so i got my certificate and now my website uses https protocol.

Everything is good to this point.

But there is a but. :)

I’m using node.js on my website. It connects to my mongoDB cluster and it creates an api url based on my domainname or/and droplet IP address.

For example my API_URL is:
I fetch that URL and do somethings on my website based on items.

But as i followed https protocol tutorial, i just enabled my firewall and because of that i guess, firewall is blocking my API URL and i get error on fetch.

I also can’t reach that API_URL( manually.

While firewall is closed i can fetch my api.

What should i do?


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.

Submit an Answer
1 answer

Since you followed the tutorial, I guess you configured firewall rules using ufw management tool. If I am right, list the rules and check if communication is allowed on port TCP 5000

sudo ufw status verbose

If it is not allowed, you can allow it adding a rule:

sudo ufw allow 5000/tcp

Here is the tutorial on configuring firewall with ufw management tool:

by Brian Boucheron
This tutorial will show you how to set up a firewall with UFW on Ubuntu 20.04.