0

We're trying to present the WebSocket-enabled interface from a remote device on our website.

I've configured the WebSocket tunnel in Apache, but I'm getting a "400 Proxy Error" in Firefox (in Chrome: "Websocket connection to ... failed"), and the WebSocket upgrade fails (the upgrade request never reaches the remote device). Firefox is using wss://, and the proxy is going to an insecure ws:// scheme on the remote host.

Apache proxy configuration is:

<Location /ws/>
    ProxyPass http://10.1.2.3/
    ProxyPassReverse /
    
    RewriteEngine on
    RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
    RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]
    RewriteRule (.*) ws://$1 [P]
</Location>

The Apache error log shows the proxy going to the right end-point, and gives an "OK" status:

[rewrite:trace1] mod_rewrite.c(483): [perdir /ws/] pass through proxy:http://10.1.2.3/socket.io/1/?t=1619199242068
[rewrite:trace1] mod_rewrite.c(483): [perdir /ws/] go-ahead with proxy request proxy:ws://proxy:http://10.1.2.3/socket.io/1/websocket/Ecr8KsStUznLLly3Av_f [OK]

How can I get more information on the cause of this failure, or how can I fix it?

Roger Dueck
  • 131
  • 5
  • 17
  • Downvoted without any comments on how I can improve this? Please advise if there's something wrong with this question! – Roger Dueck Apr 27 '21 at 15:19

1 Answers1

0

I wasn't able to resolve the issue with Apache, so I switched to handling the proxying in our haproxy frontend, with SSL termination, and that worked.

Roger Dueck
  • 131
  • 5
  • 17