WebAssembly WebSocket client ignoreSslErrors
-
Hi,
How it could be possible in Qt for WebAssembly to call the ignoreSslErrors function on my secure WebSocket (wss) client in order to overcome the self-signed certificate error?
Thanks.
-
I researched the same thing and concluded it can't be done. The Qt WebSocket in WASM is a thin wrapper over the browser websocket support - same thing that can be used in Javascript. And that does not support ignoring SSL errors, see https://security.stackexchange.com/questions/211618/bypassing-valid-certificate-requirement-for-websockets/211636#211636.
Only thing that does work, is to gain access to wss://IP:PORT, first open https://IP:PORT/index.html in your browser and manually make the user click "Proceed to IP (unsafe). After that you can open a websocket to same IP:PORT.
This is for me enough to test my app. In production should use a valid certificate.
Another option for testing might be to use the qtwasmserver described in https://doc.qt.io/qt-6/wasm.html#running-applications but I personally have not tried it.