Mossy Posted November 3, 2025 Posted November 3, 2025 Hi How is possible to make the websocket connection as wss and not ws. I am using caddy for https connection. I get the following error on browser. Mixed Content: The page at 'https://xxxx.portal.xxxx.co/' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://xxxx.portal.xxxxx.co/uniWebSocket/_S_ID='1_E82935bhQd111F851D4'&_app='uniguixxx_exe''. This request has been blocked; this endpoint must be available over WSS. Uncaught SecurityError: Failed to construct 'WebSocket': An insecure WebSocket connection may not be initiated from a page loaded over HTTPS. at Object.createSocket (ext-unicommon-min.js:9:3242) at Object.openSocket (ext-unicommon-min.js:9:2108) at Object.timerHandle (ext-unicommon-min.js:9:2511) at ext-unicommon-min.js:9:2248 Regards Quote
Mossy Posted November 4, 2025 Author Posted November 4, 2025 Hi I found a solution to this issue. To make the websocket work as WSS add the followimg Javascript to you main form function window.afterrender(sender, eOpts) { // Force WebSocket to use WSS when site is under HTTPS if (location.protocol === 'https:') { var oldCreateSocket = ajaxRequest.createSocket; ajaxRequest.createSocket = function(url) { if (url.startsWith('ws://')) { url = url.replace('ws://', 'wss://'); } return oldCreateSocket.call(this, url); }; } } Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.