Skip to content

Use routes_pathname_prefix for internal Alive URL in Dash app #3281

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 16, 2025

Conversation

Chiragasourabh
Copy link
Contributor

@Chiragasourabh Chiragasourabh commented Apr 16, 2025

When running a Dash app behind a proxy, the internal alive check (used during app startup) fails if the app is initialized with only requests_pathname_prefix, or if requests_pathname_prefix differs from routes_pathname_prefix.

This results in a misleading error:

OSError: Address 'http://127.0.0.1:9090' already in use.
Try passing a different port to run.

This is due to the alive check attempting to construct the URL using requests_pathname_prefix, which may not route correctly internally.

Solution

This PR updates the internal alive URL construction logic to use routes_pathname_prefix, which is the correct prefix for server-side routing and internal endpoint resolution.

This

  • Prevents startup failures when requests_pathname_prefix != routes_pathname_prefix
  • Ensures internal health check (alive check) functions correctly
  • Unblocks deployment in more complex reverse-proxy setups

Contributor Checklist

  • I have broken down my PR scope into the following TODO tasks
    • task 1
    • task 2
  • I have run the tests locally and they passed. (refer to testing section in contributing)
  • I have added tests, or extended existing tests, to cover any new features or bugs fixed in this PR

optionals

  • I have added entry in the CHANGELOG.md
  • If this PR needs a follow-up in dash docs, community thread, I have mentioned the relevant URLS as follows
    • this GitHub #PR number updates the dash docs
    • here is the show and tell thread in Plotly Dash community

Copy link
Contributor

@T4rk1n T4rk1n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💃 Looks good, thank you.

@T4rk1n T4rk1n merged commit 4031d0e into plotly:dev Apr 16, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants