cloudflared
cloudflared copied to clipboard
🐛 Websocket timeout when upgrading insequre ws request to use wss
Describe the bug I'm trying to remotely access a Bela device . A webpage can be accessed on port 80 and certain parts of the webpage need a websocket connection (:5555) page to render. Locally the whole page works but remotely the websocket part fails to load. Firefox console gives me:
- HTTPS-Only Mode: Upgrading insecure request “ws://bela.domain.app:5555/gui_data” to use “wss”.
- Firefox can’t establish a connection to the server at wss://bela.domain.app:5555/gui_data.
My config.yaml looks like this:
url: http://localhost:80
tunnel:
credentials-file:
ingress:
- hostname: bela.domain.app
service: http://localhost:80
- hostname: bela.domain.app
service: ws://localhost:5555
- service: http_status:404
Ok, after some digging I changed a line in a file called BelaWebSocket.js to use wss, now it looks like this:
this.url = "wss://" + this.ip + ":"+this.port+"/"+this.address;
The firefox dev console however now gives me:
Firefox can’t establish a connection to the server at wss://bela.domain.net:5555/gui_control.
Error: undefined
error { target: WebSocket, isTrusted: true, srcElement: WebSocket, currentTarget: WebSocket, eventPhase: 2, bubbles: false, cancelable: false, returnValue: true, defaultPrevented: false, composed: false, … }
Socket closed
Reconnecting(1)...
Object { port: 5555, address: "gui_control", ip: "bela.domain.net", ws: WebSocket, connectInterval: 1500, url: "wss://bela.domain.net:5555/gui_control", projectName: null, sliders: [], selectors: [], gui: null, … }
Retrying connection in 1500 ms
It says closed but
netstat -tuln | grep 5555
tcp 0 0 0.0.0.0:5555 0.0.0.0:* LISTEN
I have changed the ingress rule to use wss to but to no avail unfortunately
is there any kind of base url config on your webapp? because it's supposed to only access bela.domain.net instead of bela.domain.net with port 5555
Honestly, I still have no clue how to make it work. If anyone ever finds out, love to hear from you :) Also posted this issue on the Bela forum.