0

From a previously asked question I know that I can route requests to a different servers with reverse proxy, such as mod_proxy for apache. My question is, before I dig deeper into its setup, which of the reverse proxy's will allow me make a route decision based on the HTTP or ws in the request header. So for example, I'd like all requests coming in to https://example.com to be routed to lanserver:443, while requests, coming to proxy with wss://example.comto be routed to web socket endpoint at lanserver:8443.

Would this be possible with mod_proxy? Or any other Linux proxy?

Thanks.

Maxim V. Pavlov
  • 653
  • 2
  • 11
  • 29

1 Answers1

1

Since I answered your first question, I might as well answer this one too. :)

It looks like mod_proxy can do it, but so can Nginx and HAproxy (or here).

Those links at least shows that the proxying of WebSockets works, but how you'd actually do it with Apache or Nginx would require some work.

On the otherhand, the HAproxy links provided show exactly how to do it the way you want.

Spoiler: you detect the presence of the Upgrade: websocket header and route based on that.

GregL
  • 9,030
  • 2
  • 24
  • 35