Description
openedon Nov 9, 2024
I am running a dash app on a remote AlmaLinux machine. I connect to the remote machine from a Windows 10 computer via a ssh tunnel: "ssh -L 8050:localhost:8050 AlmaLinuxServerName. The AlmaLinux computer has restrictive rules preventing connections on all but a few ports coming in on its external IP interfaces but much less restrictive rules for connections to the localhost interface.
The dash app would start and run on AlmaLinux , but Windows 10 connecting over the SSH tunnel would get ERR_CONNECTION_RESET errors in the web browser and the terminal of the AlmaLinux would get a "channel 3: open failed: connect failed: Connection refused" every time the web browser tried to refresh.
Furthermore no matter what values I put into the host for the dash run() command, I would get:
netstat -ltun | grep 8050
tcp 0 0 AlmaLinuxURL:8050 0.0.0.0:* LISTEN
Where AlmaLinuxURL is the hostname in my AlmaLinux environment variable. Based on the network configuration, I need the result to be something like:
netstat -ltun | grep 8050
tcp 0 0 localhost:8050 0.0.0.0:* LISTEN
Note, other versions of the localhost name would work (127.0.0.1 etc)
- replace the result of
pip list | grep dash
below
dash 2.18.1
dash-core-components 2.0.0
dash-html-components 2.0.0
dash-table 5.0.0
- if frontend related, tell us your Browser, Version and OS
Not relevant but tested with,- OS: Windows 10, AlmaLinux
- Browser: Chrome,Firefox
Describe the bug
OS host environment variable overrides explicitly set host with an app.run_server(debug=True, port=8052,host="localhost") call. This is an issue on my compute host because the external IP interface is locked down to outside connections and will only allow connections to localhost via an ssh tunnel. The hostname in my environment variable points to the locked-down external IP interface. So, it doesn't matter what I put into the run_server call. Dash overwrites this with the locked-down interface, and the Flask app is unavailable.
After a lot of debugging, I was able to get my dash app working I added an
os.environ["HOST"] = "127.0.0.1" call to my code before initializing dash. This allowed me to set the flask host to the one I expected. This didnt solve the issue that I expected to get the host name that I set; but it did let the app run.
Expected behavior
When the host is explicitly set, it should override the default or environment variables. If it is considered desirable to change the host or port via environment variables instead of code, Dash should adopt environmental variables specific to Dash, for example, DASH_HOST and DASH_PORT.
Activity