RemoteViz uses WebSocket protocol to make possible the communication between the client and the service. Without any web servers between the client and the RemoteViz service, a WebSocket connection can be established smoothly. However, in production environments, the web page requests are handled by a web server and only the web server port (port 80 by default) is open from the outside to guarantee security. To use the same port and domain for the HTTP requests and the Websocket requests, the websocket traffic has to be routed through the web server. This document explains how to configure IIS server as reverse proxy to handle web page requests and websocket traffic over the same port and domain.
To enable support for the WebSocket Protocol on Windows Server, use the following steps:
To make the difference between a regular HTTP request and a WebSocket (RemoteViz) request, you have to install IIS Application Request Routing to create routing rules based on the URL.
You can install ARR from the Web Platform Installer module. To install, click on the link at the top of the page: http://www.iis.net/downloads/microsoft/application-request-routing . It is also possible to install ARR by downloading the MSI package: http://blogs.technet.com/b/erezs_iis_blog/archive/2013/11/27/installing-arr-manually-without-webpi.aspx
The following example shows the web.config file that is used to handle the WebSocket requests directed at "/RemoteViz". Each HTTP requests containing "/RemoteViz" in the URL will be considered as a Websocket connection and will be redirected to port 8080. If your IIS web server does not contain a web.config file, you have to create one in your site's home directory.
Without/With Secure Sockets Layer (SSL) encryption:
<?xml version="1.0" encoding="utf-8" ?> <configuration> <system.webServer> <rewrite> <rules> <rule name="WebSocketProxy" stopProcessing="true"> <match url="^RemoteViz/[^\.]*" /> <conditions> <add input="{CACHE_URL}" pattern="(.+)://" /> </conditions> <!-- Replace "remoteviz_service_ip" by the RemoteViz service IP address --> <!-- {C:1} contains the used websocket protocol (ws or wss) --> <action type="Rewrite" url="{C:1}://remoteviz_service_ip:8080" /> </rule> </rules> </rewrite> </system.webServer> </configuration>
theRenderArea.connectTo("ws://127.0.0.1:8080/RenderAreaName");
by the line for using non-SSL:
theRenderArea.connectTo("ws://yourdomain/RemoteViz/RenderAreaName");
or by the line for using SSL:
theRenderArea.connectTo("wss://yourdomain/RemoteViz/RenderAreaName");