On 2018-12-04 20:00, rich...@xentu.com wrote:
I'm trying to see the WebSocket examples that ship with Tomcat 9 in
action.
If I point my browser directly at tomcat on 8080, they work.
However, Tomcat is behind an Apache2 webserver and I can't seem to get
the ProxyPass settings right. Other Tomcat applications work if I
access them via Apache, but WebSocket applications don't. The snake
demo for example, gives a 'Info: WebSocket closed' message.
Apache is on the same server as Tomcat and has the proxy_wstunnel mod
loaded.
The relevant (I think) part of my VirtualHost in the Apache2 conf
file is like this:
ProxyPass / http://127.0.0.1:8080/ #works ok
ProxyPassReverse / http://127.0.0.1:8080/ #works ok
ProxyPass / ws://127.0.0.1:8080/
ProxyPassReverse / ws://127.0.0.1:8080/
Could anyone tell me what's wrong here?
Thanks.
Richard
Luis & Christopher, thanks for your suggestions.
I've now got a VirtualHost that works, the key section being:
RewriteEngine On
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /(.*) ws://localhost:8080/$1 [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket [NC]
RewriteRule /(.*) http://localhost:8080/$1 [P,L]
taken as is from a post at stackoverflow, except that Tomcat defaults to
8080:
https://stackoverflow.com/questions/27526281/websockets-and-apache-proxy-how-to-configure-mod-proxy-wstunnel
I'd still be interested in knowing if and how this can be achieved with
ProxyPass however. I spent quite a bit of time trying to match the
protocol as well as the path in Proxy path, but if it is possible, I
couldn't get the syntax right.
Richard
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org