Skip to content

Fix healthcheck redirect issue — disable FastAPI redirect_slashes#195

Merged
welshDog merged 1 commit intomainfrom
railway/code-change-hzK2pK
May 1, 2026
Merged

Fix healthcheck redirect issue — disable FastAPI redirect_slashes#195
welshDog merged 1 commit intomainfrom
railway/code-change-hzK2pK

Conversation

@railway-app
Copy link
Copy Markdown
Contributor

@railway-app railway-app Bot commented May 1, 2026

Problem

Railway's healthcheck probe sends GET /health and does not follow redirects. FastAPI's default redirect_slashes=True causes it to return a 307 Temporary Redirect to /health/ when the route is matched with trailing-slash normalization, so the probe sees a 307 and marks the deployment as failed — resulting in 18 consecutive deployment failures.

Solution

Added redirect_slashes=False to the FastAPI(...) initialization in backend/app/main.py. This disables FastAPI's automatic trailing-slash redirect behavior, so GET /health matches the @app.get("/health") route directly and returns 200 OK without any redirect.

Changes

  • Modified backend/app/main.py

Generated by Railway

@welshDog welshDog merged commit 7e16476 into main May 1, 2026
1 of 9 checks passed
@welshDog welshDog deleted the railway/code-change-hzK2pK branch May 1, 2026 13:55
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.

1 participant