Cannot access streamlit app via nginx

Hi,
I am using 2 Streamlit apps working on port 8501 and 8502. When accessing via ip:8501 and ip:8502, everything works fine. But when I try to configure it on nginx (without docker). The webpage as though tries to load endlessly. Here is my nginx.conf file.
server {
listen 80;
server_name testup.mydomain.com;
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name testup.mydomain.com;
ssl_certificate /etc/ssl/my.crt;
ssl_certificate_key /etc/ssl/my.key;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ‘ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384’;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
ssl_prefer_server_ciphers on;
add_header X-Frame-Options “SAMEORIGIN” always;
add_header X-Content-Type-Options “nosniff” always;
client_max_body_size 2G;
add_header Referrer-Policy “no-referrer” always;
if ($request_method !~ ^(GET|HEAD|POST)$) { return 444; }
location / {
proxy_pass http://ip:8501/;
}
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection “upgrade”;
proxy_read_timeout 86400;
}
The same for test.mydomain.com on port 8502

What is the problem?((