CMDBuild Forum

WebSocket connection failed when using Apache2 as reverse proxy

Hello,
I have installed the newest openMAINT version (2.2-3.3.2-w) and the Alfresco community 7.0.0.
Everything was working smoothly. Then, I installed Apache2 as reverse proxy for Tomcat (ProxyPass) and I enforced the use of HTTPS (rewrite).
Even though everything is operating fine, now I can see in chrome devtools the following error:

WebSocket connection to ‘wss://MY.DOMAIN.NAME/openmaint/services/websocket/v1/main’ failed:
initWebSoket @ app.js?_dc=20211014102300:1

Dear @dim.dim, I have a quite similar reverse proxy deployment: I have two Apache httpd 2.4 instances acting as reverse proxy for several servers, each hosting one or more web applications. Each machine as Centos 7 as operating system.
I solved it adding a specific reverse proxy rule combined with a url rewriting condition to my file containing all reverse proxy rules for my web applications.
Following the relevant config:

RewriteEngine on
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule ^/?(.*) "wss://cmdb-host:8443/$1" [P,L]
ProxyPass     /cmdbuild/services/websocket   https://cmdb-host:8443/cmdbuild/services/websocket
ProxyPassReverse      /cmdbuild/services/websocket   https://cmdb-host:8443/cmdbuild/services/websocket

cmdb-host is my machine hosting an installation of CMDBuild 3.4.
I have all reverse proxy configuration in a dedicated file in /etc/httpd/conf.d/ folder. After modified it, simply reload the configuration (you don’t need to restart the server):

systemctl reload httpd.service

In order to make this configuration work, you have to enable mod_proxy_http and mod_proxy_tunnel modules in your httpd instance. In my Centos 7 server I uncommented the following lines in /etc/httpd/conf.modules.d/00-proxy.conf:

LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so

After that, you need to restart your httpd server:

systemctl restart httpd

Hope this can help.