The firewall blocks all my requests

I have two droplets. The first is used for my frontend app and the second is used for my backend. I want to restrict my backend to my frontend but i cannot. I tried many way but not succes. I follow this tutorial -firewallsExample link My backend droplet restrict all requests

Thanks in advance.


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

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.

Hi @KDSys ,

Thanks you for your response. I forgot to say that my backend use Docker-compose. I allow all conections from frontend droplet but i want to restrict my backend droplet to my frontend droplet or my own network. I use nginx and Docker for my backend.

Thanks you

Hi @dmm2019,

If you wish for your frontend app to connect to your backend app, all you’ll need to do is allow all connections from the frontend droplet. The exact command is

iptables -I INPUT -p tcp -s XXX.XXX.XXX.XXX -j ACCEPT
iptables -I OUTPUT -p tcp -d  XXX.XXX.XXX.XXX -j ACCEPT`

Just replace the XXX.XXX.XXX.XXX with your droplet’s IP address.

Regards, KDSys