This is the first in a series of posts on WebSocket proxy configuration.

ColdFusion uses dedicated port (8575/8577) to start its internal WebSocket Server by default. Earlier, these ports were required to be always accessible from outside. This setup works well for intranet applications. But for public facing web applications, it is not advisable to keep port open and let it be accessible from outside.

ColdFusion 11 has introduced proxy support for WebSocket. There is a new proxy module that can be configured with IIS and Apache Web Server which intercept ColdFusion WebSocket requests and redirect the requests to the ColdFusion’s internal WebSocket Server. Now, web applications communicate to WebSocket server over the same port on which web application is running.

How to start WebSocket proxy service?

In order to start WebSocket proxy service follow steps mentioned below:

  • Login to ColdFusion Administrator.
  • Navigate to Server Settings > WebSocket.
  • Select “Use Proxy” option under Enable WebSocket Service.
  •  Submit Changes.
  • Restart ColdFusion Application service.
  •  

    How to configure WebSocket proxy with ColdFusion?

    We have shipped WebSocket Proxy Configuration tool along with ColdFusion 11 which can be used to configure WebSocket proxy with IIS and Apache Web Server on all supported platforms.

    WebSocket Proxy Configuration tool can be located at:

    •  <cf_install_root>/cfusion/bin/wsproxyconfig.exe(for windows platform)
    •  <cf_install_root>/cfusion/bin/wsproxyconfig.sh(for non-windows platform)

    Supported web servers with WebSocket proxy:

    • IIS 8 or above
    • Apache Web Server 2.2.*

    Upcoming posts in this series:

    • How to configure WebSocket proxy with IIS
    • How to configure WebSocket proxy with Apache Web Server
    • Tuning ColdFusion 11 WebSocket proxy configuration with IIS 8 or above

     

    7 Comments to “Why should we use WebSocket Proxy?”

    1. Seth
      Just curious if WSS connections (WebSocket over SSL) can be proxied in this manner. Looking forward to your HowTo for apache. Thanks!
    2. Hannah
      This breakdown is really helpful and easy to understand. Thanks for posting it!
    3. Brad
      Is there a way to configure websockets to work with the proxy and Apache 2.4.10+
    4. Nimit Sharma
      @Brad: Have you tried configuring Apache 2.4.10+ with WebSocket?

      You can try configuring WebSocket proxy with Apache 2.4.10+ and share error message if there is any issue.
    5. Brad
      The provided config tool generates:

      LoadModule websocket_module "C:\ColdFusion11\config\wsproxy\1\mod_websocket.so"
      <IfModule mod_websocket.c>
      <Location /cfws>
      SetHandler websocket-handler
      WebSocketHandler "C:\ColdFusion11\config\wsproxy\1\mod_wsproxy.so" _proxy_init@0
      </Location>
      </IfModule>

      When using this tool with Apache 2.4.x you get these two errors:

      >>> httpd.exe: Syntax error on line 551 of D:/Apache24/conf/httpd.conf: Syntax error on line 1 of C:/ColdFusion11/config/wsproxy/1/mod_wsproxy.conf: API module structure 'websocket_module' in file C:/ColdFusion11/config/wsproxy/1/mod_websocket.so is garbled -

      The Apache service named reported the following error:
      >>> expected signature 41503234 but saw 41503232 - perhaps this is not an Apache module DSO, or was compiled for a different Apache version?

      This makes me think that these are not compiled for Apache 2.4.x

      We tried downloading and using a custom compiled version of mod_websocket.so that is supposed to work with Apache 2.4.x. We got the version here : http://fossies.org/windows/www/httpd-modules-2.4-win64-VC11.zip/index_o.html. You can read here how it was created: http://fossies.org/windows/www/httpd-modules-2.4-win64-VC11.zip/mod_websocket/mod_websocket/README.md

      This let us actually start Apache but then we got this error:

      The Apache service named reported the following error:?>>> AH00526: Syntax error on line 6 of C:/ColdFusion11/config/wsproxy/1/mod_wsproxy.conf: .
      The Apache service named reported the following error:?>>> Could not find initialization function in module .
      WebSocketHandler "C:\ColdFusion11\config\wsproxy\1\mod_wsproxy.so" _proxy_init@0

      Let me know if you have had any luck getting this setup to work in Apache 2.4.x

      Thanks!

      -Brad
    6. Nimit Sharma
      @Brad: How did you compile apache binary?

      It should be compile with worker module and not with prefork.
    7. Brad
      We're running a precomplied Apache under windows from Apache Lounge. Compiled with VC14 running WinNT MPM not forked.

    Leave a Comment

    Leave this field empty: