WebSocket connection to 'ws://testm.10jqka.com.cn/domain_test/_stcore/stream' failed:

I’m having trouble deploying my project. When accessing it with a local address, everything works fine. However, after configuring Nginx, the address is no longer accessible, and I’m getting the following error in the console:

main.5e4731c6.js:2 WebSocket connection to 'ws://testm.10jqka.com.cn/domain_test/_stcore/stream' failed:

I have spent a lot of time searching through similar posts, but none of the solutions seem to work for me. I’m feeling quite frustrated about this. Below is my Nginx configuration:

location /domain_test/ {
    proxy_pass http://127.0.0.1:8501/;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header X-Real-IP $remote_addr;
}

location /domain_test/_stcore/stream {
    proxy_pass http://127.0.0.1:8501/_stcore/stream;
    proxy_http_version 1.1;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Origin $host;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
    proxy_set_header Host $host;
}

my streamlit version:1.22.0
I would greatly appreciate any help in resolving this issue.

Hey @szyab,

Have you checked out these posts?