Socket issue with rasa webchat on HTTPS

@bharath-madduri @nik202 @InnoOmnia Hi guys, it will be very helpful if you guide me to resolve the issue. I have tried many things but nothing seems to work. so, at last, came here to the forum. Below is the version info:

Rasa Version      :         3.4.0
Minimum Compatible Version: 3.0.0
Rasa SDK Version  :         3.4.0
Python Version    :         3.8.10
Operating System  :         Linux-5.15.0-1031-azure-x86_64-with-glibc2.29
Python Path       :         /usr/bin/python3
python-engineio   :         4.3.3
python-socketio   :         5.7.1

When I run rasa webchat with the below socketUrl (HTTP) it runs totally fine without any socket disconnection issues.

....
        "https://cdn.jsdelivr.net/npm/rasa-webchat@1.0.1/lib/index.js"),
        (e.async = !0),
        (e.onload = () => {
          window.WebChat.default(
            {
              initPayload: '/greet',
              customData: { language: "en" },
              socketUrl: "http://azure_vm_ip_with_port/",
              title: 'Chat with us'
....

But when I pass the HTTPS URL of the rasa server to socketUrl (as I want to deploy chatbot on my website which is HTTPS)

....
socketUrl: "https://my_website_subdomain_url/",
....

I am getting the below set of errors:

With the above errors, sometimes webchat appears on my website and sometimes not.

I am running both rasa and action server. Rasa server is running on port 5005 and to make it HTTPS, I have used NGINX reverse proxy.

Reverse proxy part is done right as I am getting “Hello from Rasa: 3.4.0” by hitting “https://my_website_subdomain_url/”

Things I have already tried:

  1. As suggested by @InnoOmnia, for crosscheck tried running curl “https://my_website_subdomain_url/socket.io/?EIO=4&transport=polling=4” and got proper output
  2. As suggested by @bharath-madduri, tried changing the rasa port from HTTP/HTTPS to TCP in the inbound port rules of my azure VM
  3. Tried different versions of python-engineio and python-socketio, but no luck

Sorry for the long thread, but I tried to be as descriptive as possible about the issue.