I have an AngularJS with Spring REST MVC backend application. I'm trying to set up reverse proxy for the application, with the help of the proxy server admin. He got almost everything to work except for the websocket. The weird thing is if I added the port number to the reverse proxy URL, then websocket works too. For example:
https://proxy.example.com/myApp
doesn't work with websocket. However, https://proxy.example.com:8443/myApp
works with websocket.
I'm at a lost here. We've try many different things. Could you see what is missing in the configuration?
<VirtualHost *:443>
ServerName proxy.example.com
ServerAlias testServer
SSLEngine on
SSLProxyEngine on
SSLCertificateFile /etc/ssl/certs/example.com_07012022.cer
SSLCertificateKeyFile /etc/ssl/certs/example.com_07012022.pem
ProxyPass / https://proxy.example.com:8443/
ProxyPassReverse / https://proxy.example.com:8443/
RewriteEngine on
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule .* "wss://proxy.example.com:8443/$1" [P,L]
</VirtualHost>
The ProxyPass
and ProxyPassReverse
doesn't look right, but I couldn't even hit the homepage with the following config:
ProxyPass / https://localhost:8443/
ProxyPassReverse / https://localhost:8443/
Thanks. Appreciate the help.
question from:
https://stackoverflow.com/questions/65852939/apache-websocket-only-works-on-reverse-proxy-if-included-port-number 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…