Cloudflared Docker: Browser VNC not working

I am running cloudflared Docker on a Raspberry Pi 4. I have created a tunnel and have configured multiple public hostnames. All of this works really well.

More recently, I wanted to try configuring browser SSH and VNC with the Emails policy so that I can access my Raspberry Pi 4 remotely. I managed to successfully get the browser SSH working by following the documentation. However, I am having trouble getting the browser VNC to work. I have followed https://developers.cloudflare.com/cloudflare-one/tutorials/vnc-client-in-browser/ but ended up getting the page with this error:

The origin has unexpectedly closed the connection. Please confirm that the origin is healthy.
Head to our Developer Docs for additional troubleshooting steps.

Note 1: I can confirm that I can connect to the Raspberry Pi 4’s VNC Server using a VNC client.
Note 2: Public hostname service for my browser VNC is set as tcp://localhost:5900 (I confirmed the port of VNC as well).

In the console I get either of these 3 errors when trying to load my browser VNC:

I am using the latest version of Real VNC Server with these Security settings:

Encryption: Prefer off
Authentication: VNC password

I have referred https://community.cloudflare.com/t/ssh-vnc-browser-rendering-fails/304487 which seems to be similar to my issue but I was not able to understand how to configure the short-lived certificates in my cloudflared Docker container as mentioned in the solution even after following https://developers.cloudflare.com/cloudflare-one/identity/users/short-lived-certificates/.

For reference this is how my cloudflared Docker container is configured:

pi@raspberrypi:~/Docker/cloudflared $ tree
.
├── cert.pem
└── docker-compose.yml

0 directories, 2 files

My docker-compose.yml is as follows:

version: "2.1"
services:
  cloudflared:
    image: erisamoe/cloudflared
    container_name: cloudflared
    network_mode: host
    environment:
      - TUNNEL_TOKEN=<My Tunnel Token>
    command: tunnel run
    restart: unless-stopped

Any help would be appreciated.

Hello,
I had the same problem. Just deactivate Real VNC server and install tightvnc.