Streamlit app stuck when deployed AWS EC2 through Nginx

Hi everybody,
my problem is when using streamlit==1.29.0 and deploying on EC2 with nginx, the UI is stuck when opening through my domain, however through external public IP of the EC2 it works.
Streamlit UI stuck screenshot:

This is what I have in /etc/nginx/sites-available/default:

server {
    listen 80;
    server_name mydomain.ai;
    
    # Redirect all HTTP traffic to HTTPS
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl;
    server_name mydomain.ai;

    ssl_certificate /etc/letsencrypt/live/mydomain.ai/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/mydomain.ai/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

    # Proxy all requests to Streamlit app
    location / {
        proxy_pass http://localhost:8501;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

With curl -I https://mydomain.ai:


HTTP/1.1 200 OK

Server: nginx/1.24.0 (Ubuntu)

Date: Tue, 12 Nov 2024 04:44:00 GMT

Content-Type: text/html

Content-Length: 892

Can please somebody help or anybody had a similar issue before?

Thanks a ton,
Daniel