apache2 - Reverse proxy with websocket mod_proxy_wstunnel -


i have problem web sockets , reverse proxy apache, have upgraded in latest release 2.4.5 , loaded 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 </proxy> </virtualhost> 

when test in local url, websockets working reverse proxy apache, there no trace in tomcat logs.

this line:

proxypass /my_app/basicwebsocketservlet ws://1x.x.x.1:8080/my_app/basicwebsocketservlet retry=0 

needs come before one:

proxypass /my_app  http://1x.x.x.1:8080/my_app 

explanation (from https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxypass):

ordering proxypass directives

the configured proxypass , proxypassmatch rules checked in order of configuration. first rule matches wins. should sort conflicting proxypass rules starting longest urls first. otherwise later rules longer urls hidden earlier rule uses leading substring of url. note there relation worker sharing. in contrast, 1 proxypass directive can placed in location block, , specific location take precedence.

for same reasons exclusions must come before general proxypass directives.


Comments