QWebSocket in WebAssembly fails when connecting to wss://example.com:10443/wss/ but works when connecting to a apache wss proxy at wss://example.com:443/wss/
-
I'm encountering an issue with QWebSocket compiled to WebAssembly that does not occur when compiled to GNU/Linux or Windows.
I have implemented a simple WebSockets server and a simple WebSockets client that will be the foundation for a client/server application pair. The application server will run on a GNU/Linux server while the GUI application clients will run on GNU/Linux, Windows (10 or later) and in a browser using WebAssembly.
Currently the GNU/Linux and Windows application clients work correctly and can connect directly to the server without issues.
The problem is the WebAssembly application client failing to connect to the server with the error "The remote host closed the connection" (QAbstractSocket::UnknownSocketError). This error happens with both Firefox and Chrome (up-to-date versions).
I have also setup apache on the server with a wss proxy to the app server. If I point the clients to this proxy all application clients work correctly.
The URL used to connect directly to the applications server is: wss://example.com:10443/wss/
The URL used to connect to the apache proxy is: wss://example.com:443/wss/Both the application and the proxy use the same letsencrypt certificate and both Firefox and Chrome accept them as valid for HTTPS.
sslscan shows the exact result (except for the IP port) for both the apache proxy and the application server.
So, in summary:
[GNU/Linux application client] --> [apache wss proxy] --> [GNU/Linux application server] : WORKS
[Windows application client] --> [apache wss proxy] --> [GNU/Linux application server] : WORKS
[WebAssembly application client] --> [apache wss proxy] --> [GNU/Linux application server] : WORKS
[GNU/Linux application client] --> [GNU/Linux application server] : WORKS
[Windows application client] --> [GNU/Linux application server] : WORKS
[WebAssembly application client] --> [GNU/Linux application server] : FAILSI would prefer to avoid having to use a proxy due to the increased latency and server load.
The error message "The remote host closed the connection" seems to indicate that the application server disconnects from the client but nowhere in my code do I disconnect from the clients. It is the clients that disconnect so the issue is probably in the guts of QWebSocketServer but QWebSocketServer does not signal any error.
Any advice is welcome.