0

I have a specific problem where I have a host that cannot be connected to from outside IPs (let's call it server 1), but can initiate connections with other servers. However, I need to make a TCP server on this host accessible from outside connections on a specific port. I have another server with a static IP (server 2) that can be connected to directly, so I'm wondering, is it possible to essentially reverse the flow of traffic from server 1 so that connections are initiated from it instead of server 2 with HAProxy or a similar proxy server? Maybe something like:

Server 1 maintains a connection to server 2, and server 2 notifies server 1 whenever a connection is instantiated. Server 1 then connects to server 2, and server 2 routes all traffic (bidirectionally) to server 1. Server 1 then also connects this socket to the internal host TCP server and forwards all traffic to it.

Is this possible to do?

1 Answer 1

0

Yes, what you're describing sounds like a classic use case for reverse proxy chaining using HAProxy or SSH tunneling.

Since Server 1 can initiate outbound connections but not accept inbound ones, one approach could be to have it connect to Server 2 via reverse SSH tunnel, and then route external traffic through Server 2 to access services on Server 1.

HAProxy could also be configured on Server 2 to listen for connections and pass them through the tunnel, but you'd need to handle port forwarding carefully and ensure firewalls don’t interfere.

Depending on your use case (web service, internal access, etc.), you might also consider using tools like ngrok or Cloudflare Tunnel for temporary remote access.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.