Summary

RemoteViz uses WebSocket protocol to make possible the communication between the client and the service. In real environments, the network traffic can be routed through a front-end to optimize it. This document explains how to configure HAProxy to route WebSocket requests to the RemoteViz service and HTML page requests to the web server over the same port and domain.

Compatibility

HAProxy supports Websocket proxing from the version 1.4.

HAProxy Installation

Please refer to the HAProxy official documentation to install HAProxy:

HAProxy Configuration

In the next section, we consider that the front-end is bound to yourdomain:80 (public), the web server (Apache, NGinx, IIS, ...) is bound to 10.0.0.1:8000 (behind a firewall) and the RemoteViz service is bound to 10.0.0.2:8080 (behind a firewall). There are three ways to proxy WebSocket connections through HAProxy.

Proxy based on sub-domain

In this case, the websocket connection is differentiated from other requests by using a sub-domain. In the below example, all traffic going to remoteviz.yourdomain will be redirected to the RemoteViz service.