Why should we use WebSocket Proxy?

July 14, 2015
Staff 16 posts
Followers: 0 people
7

Why should we use WebSocket Proxy?

Staff 16 posts
Followers: 0 people
July 14, 2015

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

     

    Comments (7)
    2015-10-28 13:02:43
    2015-10-28 13:02:43

    We’re running a precomplied Apache under windows from Apache Lounge. Compiled with VC14 running WinNT MPM not forked.

    Like
    2015-10-27 03:16:26
    2015-10-27 03:16:26

    @Brad: How did you compile apache binary?

    It should be compile with worker module and not with prefork.

    Like
    2015-10-26 07:39:08
    2015-10-26 07:39:08

    The provided config tool generates:

    LoadModule websocket_module “C:ColdFusion11configwsproxy1mod_websocket.so”

    SetHandler websocket-handler
    WebSocketHandler “C:ColdFusion11configwsproxy1mod_wsproxy.so” _proxy_init@0

    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:ColdFusion11configwsproxy1mod_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

    Like
    2015-10-25 20:33:01
    2015-10-25 20:33:01

    @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.

    Like
    2015-10-23 09:29:40
    2015-10-23 09:29:40

    Is there a way to configure websockets to work with the proxy and Apache 2.4.10+

    Like
    2015-09-24 10:17:08
    2015-09-24 10:17:08

    This breakdown is really helpful and easy to understand. Thanks for posting it!

    Like
    2015-07-28 14:03:38
    2015-07-28 14:03:38

    Just curious if WSS connections (WebSocket over SSL) can be proxied in this manner. Looking forward to your HowTo for apache. Thanks!

    Like
    Add your comment