2

I have a little problem with the web sockets and my reverse proxy apache, i have upgraded in latest release 2.4.5 and loaded the module mod_proxy_wstunnel.

The httpd.conf :

     <VirtualHost *:80> 
ServerAdmin webmaster@localhost 
ServerName www.toto.fr 
ServerAlias toto.fr


    ProxyPass /my_app  http://1X.X.X.1:8080/my_app 
    ProxyPassReverse /web_pmr  http://1X.X.X.1:8080/my_app 
    ProxyPassReverseCookiePath /my_app / 
    ProxyPassReverseCookieDomain localhost my_app 
    ProxyRequests off 
    ProxyTimeout 15

        #WEBSOCKETS


        ProxyPass /my_app/BasicWebsocketServlet ws://1X.X.X.1:8080/my_app/BasicWebsocketServlet retry=0 
    ProxyPassReverse /my_app/BasicWebsocketServlet ws://1X.X.X.1:8080/web_pmr/BasicWebsocketServlet retry=0


ErrorLog "logs/my_app_error.log" 
LogLevel debug 
CustomLog "logs/my_app_access.log" combined 

<Proxy *>
              Order deny,allow
              Allow from all 
</Proxy> 
</VirtualHost>

When i test in my local url, websockets are working but with the reverse proxy apache no trace in tomcat logs.

List of loaded modules :

Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_event_module (static) authn_file_module (shared) authn_core_module (shared) authz_host_module (shared) authz_groupfile_module (shared) authz_user_module (shared) authz_core_module (shared) access_compat_module (shared) auth_basic_module (shared) filter_module (shared) mime_module (shared) log_config_module (shared) env_module (shared) headers_module (shared) setenvif_module (shared) version_module (shared) proxy_module (shared) proxy_connect_module (shared) proxy_ftp_module (shared) proxy_http_module (shared) proxy_fcgi_module (shared) proxy_scgi_module (shared) proxy_fdpass_module (shared) proxy_wstunnel_module (shared) proxy_ajp_module (shared) proxy_balancer_module (shared) proxy_express_module (shared) slotmem_shm_module (shared) slotmem_plain_module (shared) ssl_module (shared) lbmethod_byrequests_module (shared) lbmethod_bytraffic_module (shared) lbmethod_bybusyness_module (shared) lbmethod_heartbeat_module (shared) unixd_module (shared) status_module (shared) autoindex_module (shared) dir_module (shared) alias_module (shared) rewrite_module (shared)

Thank you.

WhatsUp
  • 125
  • 2
  • 2
  • 5

1 Answers1

3

Trailing slash must be added to path, it's necessary to handle web socket requests as GET requests (httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxypass)

something like:

ProxyPass        /my_app/BasicWebsocketServlet/ ws://1X.X.X.1:8080/my_app/BasicWebsocketServlet/ retry=0
ProxyPassReverse /my_app/BasicWebsocketServlet/ ws://1X.X.X.1:8080/web_pmr/BasicWebsocketServlet/ retry=0
Ladadadada
  • 25,847
  • 7
  • 57
  • 90
crazyman
  • 116
  • 5