Websockets, Nginx, cloudflared tunnel

Hi Dear community,

I’ve been working on a proyect to run a chat, with websockets, nginx and cloudflared tunnel.

actually, the chat runs in a local way, but when I use cloudflared tunnel to have connections in others networks. in this way I can’t run websockets withe the port 8443, I will share the relevan code for config.yml, nginx and the client nodejs.

ingress:

hostname: francosbikergarage.com
service: https://192.168.0.2:8443
service: http_status:404

location /ws/ {
proxy_pass http://192.168.0.2:8443/ws;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection “Upgrade”;
proxy_set_header Host $host;
}
var ws = new WebSocket(‘wss://francosbikergarage.com:8443/ws’);
ws.onopen = function() {

var id_admin = $(‘#id_admin’).val();
var userType = ‘administrador’;

ws.send(JSON.stringify({
type:‘init’,
id_admin:id_admin ,
userType:userType}));

console.log(“Conexión WebSocket abierta.”);
};

I’ve been working on this work for days, I will really appreciate the help