1

I am using richfaces a4j:push in my Spring-JSF integrated application. I am able to push messages to the browser using websocket in my non cluster environment on wildfly 8.0.0. When I deploy the application on wildfly8.0.0 on redhat enterprise 7.0 with httpd clustering the push messages are not working.

I get the following error on cluster environment:

17:15:22,862 ERROR [io.undertow.request] (default task-3) UT005023: Exception handling request to /star/__richfaces_push: java.lang.IllegalStateException: UT000077: The underlying transport does not support HTTP upgrade.

My cluster is configured with mod_cluster, referring the document

When I look for details on error UT000077, it says ‘Apache httpd doesn't support HTTP upgrade out of box’ I understand HTTP upgrade is required for websocket communication. It is suggested to use mod_proxy_wstunnel. However the details are not available for this configuration.

Any pointers/suggestions are much appreciated.

Sam
  • 554
  • 1
  • 12
  • 23

3 Answers3

3

At the time of this answer AJP [which is the default one] does not support HTTP upgrade and hence not websocket.

If you switch to HTTP websocket will work.

Following changes you need to do to switch to AJP

Change

LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
#LoadModule proxy_http_module modules/mod_proxy_http.so

To

#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_http_module modules/mod_proxy_http.so

[comment out proxy_ajp_module and added proxy_http_module]

In modcluster sub-system

Change

<subsystem xmlns="urn:jboss:domain:modcluster:1.2">
<mod-cluster-config advertise-socket="modcluster" connector="ajp">
<dynamic-load-provider>
<load-metric type="cpu"/>
</dynamic-load-provider>
</mod-cluster-config>
</subsystem>

To

<subsystem xmlns="urn:jboss:domain:modcluster:1.2">
<mod-cluster-config advertise-socket="modcluster" connector="default">
<dynamic-load-provider>
<load-metric type="cpu"/>
</dynamic-load-provider>
</mod-cluster-config>
</subsystem>

[“default” is the name of the http listener]

Also you need to load mod_proxy_wstunnel in your httpd

Sam
  • 554
  • 1
  • 12
  • 23
  • And ```EnableWsTunnel``` in mod_cluster.conf. Beware: Current [mod_cluster 1.3.1.Final](https://developer.jboss.org/wiki/ModclusterVersion131FinalReleased) is capable of mod_proxy_wstunnel integration, i.e. it creates connections to the least loaded/elected nodes, but there is no failover functionality. If the worker node fails, the WS connection is lost. – Michal Karm Babacek May 18 '15 at 07:20
  • @MichalKarmBabacek does it mean, the configuration changes which Sam suggested plus EnableWsTunnel in mod_cluster.conf on a mod_cluster 1.3.1.Final will make the websocket working in one of the cluster node ? – Rakesh Aug 13 '15 at 09:07
  • 1
    @Rakesh, it will enable it for the whole cluster. Essentially, it will automatically [generate these ProxyPass directives](http://httpd.apache.org/docs/2.4/mod/mod_proxy_wstunnel.html) for you, i.e. for all contexts on all of your worker nodes. – Michal Karm Babacek Aug 13 '15 at 09:53
  • Thank you for the quick response and bringing up this good point. – Rakesh Aug 13 '15 at 10:14
  • Anyone have ideia of how to enable EnableWsTunnel using Apache 2.2 and if is it possible ? I compiled mod_proxy_wstunnel for Apache 2.2 with success but I don't know if is also possible with mod_cluster – Carlos Lacerda Nov 04 '16 at 18:45
  • Yes!! it's possible, I build mod_cluster 1.3.3 with Apache 2.2 and mod_proxy_wstunnel too. Now I can use WebSocket with Apache 2.2.Now I have another problem to synchronize client notifications spread in the nodes. Hands on work!! – Carlos Lacerda Nov 08 '16 at 19:05
1

MODCLUSTER-438 WebSocket support for mod_cluster

0

Let me give my two cents in this question to people there are using Apache 2.2.x If are you using Apache 2.2.x you need to compile the mod_proxy_wstunnel from Apache 2.4 for Apache 2.2.x This link have a how to do it. Following, to achieve WebSockets with mod_cluster you need also compile mod_cluster 1.3.3+ as described in this link and add EnableWsTunnel in your mod_cluster.conf outside your virtual host

I hope helps.

Carlos Lacerda
  • 699
  • 6
  • 14