MS authentication opening on localhost

Summary

I have a unique problem, my Streamlit app is running on server on Ubuntu, I have made nginx config, and proxy forwarded client access ip to localhost. So anyone accessing given server will be redirected to streamlit running on local-host.

The overall structure is working fine however, once I added Microsoft azure ad authentication with python’s msal lib I have following problem.

  1. User access streamlit app from his browser entering address - OK
  2. The nginx is forwarding request to local-host from given address - OK
  3. The MS authentication page will be opened on host rather than the client - NOT OK

So what is happening is that host will see that there is request for authentication but it will not open it on client browser, rather it will try to open auth request on host itself.

Is there anything in streamlit settings that will help me resolve this issue?

Nginx config:


    listen 443 ssl;
    server_name "myserver";

    ssl_certificate 'cert location for ssl';
    ssl_certificate_key 'cert location for key';

    ssl_protocols 'bunch of protocols;'
    ssl_ciphers 'bunch of ciphers';
    ssl_prefer_server_ciphers '';
    ssl_dhparam 'somelocationhere';
    location / {
        proxy_pass http://localhost:8501;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}


Thanks in advance.