How should I setup iptables for private network

September 29, 2018 745 views
Firewall Networking Ubuntu

I am trying to connect my react app with a wordpress backend as rest api. Previously I've tested with both droplet's public ip. I setup a self signed certificate for the wordpress droplet. It works except my browser need to first connect to the wordpress droplet public ip and accept the certificate before the front end app can send any authentication data.

Now I need them to talk to each other with private network and I removed the self signed certificate in wordpress droplet and received "net::ERRCONNECTIONTIMED_OUT" in my browser console. In order to connect with each other. How should I setup the iptables for private network on both droplets.

Do I need to setup incoming and outgoing with port 80 and 443(assume I will get let's encrypt later) for both droplets or I just need outgoing on front end and incoming on wordpress droplet?

I am using vpn and access my react app with private ip.

I've asked do support and someone reply me to use their load balancer. = =

2 Answers

My bad, the real issue is CORS been blocked. Will try to change the domain inside wordpress and see what's happen.

The best idea is to block all ports except 443 and 80 and block all incoming Ip addresses except your IP and all that behind your CDN.
This tutorial might help you about iptables rules: iptables firewall

Have another answer? Share your knowledge.