Firewall – Websockets and Firewall

firewallredirectionreverse-proxysocket

I asked this question on Stack Overflow first, but then I thought Server Fault could be a better place to post it.


I have two WebSocket servers both running on different ports than 80 and 443. These two servers are running behind a firewall which only has port 80 and 443 open.

WebSocket Server A:800 |
                       |-----|FireWall:80 & 443|-----> INTERNET
WebSocket Server B:801 |

What I am looking for is a way for my clients to get connected to the WebSocket servers without knowing their port and without me opening the firewall for any other ports rather than 80 and 443.

So I was thinking maybe an intermediary server (or proxy server) between my firewall and WebSocket servers can be configured in a fashion that when clients asks for www.mywebsite.com/a on port 80 or 443 (to pass the firewall) the intermediary server connects the client to WebSocket Server A. And when client asks for www.mywebsite.com/b on port 80 or 443 the intermediary server connects him to WebSocket Server B. Is this possible? and if so, is there any server you may know of that has this feature implemented?

On a different note (maybe not very different), what would be the differences between TCP hole punch and the approach I explained above?

Best Answer

It seems that you need to add a reverse proxy between your firewall and your servers.

By using websocket apache module you should be able to forward websocket requests to your servers through your reverse proxy.