Streamlit behind revese proxy doesn't work when you change port

I am trying to run streamlit behind reverse proxy.

I have following situation which works behind reverse proxy:

1.streamlit hello --server.baseUrlPath=easy
2 streamlit hello

Both works just fine independently behind reverse proxy.

However, when I try to do following it fails
streamlit hello --server.port=2000

When I look network, I see following request fail.healthz. Issue is, healthz is still ping at original port
which is seen as following as error:

1. Request URL:

http://localhost:8501/healthz

2. Referrer Policy:

no-referrer-when-downgrade

When I copy request as cURL i see following:

curl 'http://localhost:8501/healthz' \
  -H 'Accept: application/json, text/plain, */*' \
  -H 'Referer: http://localhost:3000/' \
  -H 'User-Agent: Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Mobile Safari/537.36' \
  --compressed

As you can see here. healthz is looking at wrong port. It should point to 2000 port but it pointing to 8501 port.

Am I doing this right? Or I need to change config

Stream and other request has similar problem.

Hi @kush99993s, welcome to the Streamlit community!

On first glance, this looks like a bug. Like you, I would expect the endpoint to be on the port specified. I’ll open a GitHub issue.

Thank you @randyzwitch