Restrict EC2 Traffice from Tunnel Only

I’ve a small website running on my EC2 on port 3000, I’ve made a connection via Cloud-flare Secure Tunnel using Public host-name which points to the http://:3000 at the moment. In EC2 Sec group HTTP traffic is allowed on 3000 port. Now if i go to http://:3000 the site is still accessible. what i want is to allow traffic from Cloud-flare secure tunnel only bcz at the moment the port 3000 is open for all at the moment. How can i achieve this.

You don’t need to have the port open externally if using a tunnel, as the tunnel connects out. You can remove the security group rule.

I removed the Port 3000 from Security group of Ec2 and now it stops working, Bad gateway 502 error now.

Is the tunnel running on the same instance as the service you are trying to connect to?

Yes, the Same server.

You should be using localhost as the hostname rather than the FQDN of the server.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.