Apps proxy returning 502 despite healthy app runtime

julieglass
New Contributor

I have two Databricks Apps that show RUNNING status and clean deployment logs, but both return 502 Bad Gateway when accessing their public URLs.

 

Error: Both apps return "502 Bad Gateway" when accessed via their public URLs.

Troubleshooting Attempted:
- Stop/start cycle on both apps
- Created fresh app with new name and OAuth configuration
- Verified deployment logs show "Deployment successful"
- Verified Streamlit servers running on port 8080
- Both apps exhibit identical 502 behavior
 
Any thoughts on this would be appreciated! 

balajij8
Esteemed Contributor

Hi Julie,

Host or port binding mismatch between your Streamlit application and the reverse proxy is likely. Even though the app container starts up and reports RUNNING status, the platform expects the internal server process to listen on 0.0.0.0 and bind to the port defined by the DATABRICKS_APP_PORT environment variable (defaults to port 8000). If Streamlit is explicitly forced to listen on port 8080 or bound locally to 127.0.0.1, the public proxy generally cannot route incoming web traffic to the container socket, resulting in the immediate 502 Bad Gateway error. More details here

You can remove the port/host ip references or set it to correct values (port 8000, host 0.0.0.0) as arguments in the command

command:
  - "app.py"
  - "--server.port" # Remove it
  - "8080"          # Remove it

You can remove the manually entered ports if mentioned in .streamlit/config.toml too. Check the manual Streamlit Startup Code for incorrect values. Redeploying the app with the configurations should allow the Databricks gateway to connect directly to your Streamlit runtime.

Thank you, I will try that.