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.
For Unix systems: http://www.haproxy.org/#down
frontend public
bind *:80
acl is_websocket hdr_end(host) -i remoteviz.yourdomain
use_backend ws if is_websocket
default_backend www
backend www
timeout server 30s
server www1 10.0.0.1:8000
backend ws
timeout server 600s
server ws1 10.0.0.2:8080
The websocket connection address has to be modified in the HTML client file. In the file index.html, replace the line:
theRenderArea.connectTo("ws://127.0.0.1:8080/RenderAreaName");
by the line:
theRenderArea.connectTo("ws://remoteviz.yourdomain/RenderAreaName");
frontend public
bind *:80
acl is_example hdr_end(host) -i yourdomain
acl is_websocket path_beg -i /remoteviz
use_backend ws if is_websocket is_example
default_backend www
backend www
timeout server 30s
server www1 10.0.0.1:8000
backend ws
timeout server 600s
server ws1 10.0.0.2:8080
The websocket connection address has to be modified in the HTML client file. In the file index.html, replace the line:
theRenderArea.connectTo("ws://127.0.0.1:8080/RenderAreaName");
by the line:
theRenderArea.connectTo("ws://yourdomain/remoteviz/RenderAreaName");
frontend public
bind *:80
acl is_websocket hdr(Upgrade) -i WebSocket
use_backend ws if is_websocket is_websocket_server
default_backend www
backend www
timeout server 30s
server www1 10.0.0.1:8000
backend ws
timeout server 600s
server ws1 10.0.0.2:8080
The websocket connection address has to be modified in the HTML client file. In the file index.html, replace the line:
theRenderArea.connectTo("ws://127.0.0.1:8080/RenderAreaName");
by the line:
theRenderArea.connectTo("ws://yourdomain/RenderAreaName");