Skip to content

Fix cloudflared health check using host port instead of container port - #44

Merged
aquarion merged 1 commit into
mainfrom
fix/cloudflared-healthcheck-port
Jul 30, 2026
Merged

Fix cloudflared health check using host port instead of container port#44
aquarion merged 1 commit into
mainfrom
fix/cloudflared-healthcheck-port

Conversation

@aquarion

Copy link
Copy Markdown
Member

Summary

  • docker/cloudflared/entrypoint.sh was health-checking http://application:${APP_PORT} inside the Docker network, but APP_PORT is the host-side forward port (compose.yaml maps "${APP_PORT:-80}:80") — the container always listens internally on 80, exactly as docker/cloudflared/config.yml already hardcodes for the tunnel origin.
  • Previously this only worked because .env happens to default APP_PORT=80. Any dev who changes APP_PORT to avoid a host port clash would see the tunnel container falsely report "application did not become ready" after exhausting all 60 retries (~2 minutes).
  • Fix: hardcode the internal health check to port 80, matching config.yml, and drop the now-unused .env/APP_PORT sourcing.

Flagged in review of #42 as out-of-scope for that PR; split into its own branch off main per request.

Test plan

  • bash -n docker/cloudflared/entrypoint.sh — syntax check
  • docker compose restart cloudflared — confirmed logs show Waiting for application to be ready on http://application:80...App is ready! → tunnel registers connections successfully

🤖 Generated with Claude Code

APP_PORT is the host-side forward port (compose.yaml maps
"${APP_PORT:-80}:80"), but the container-to-container health check
was using it against the internal Docker network, where the app
always listens on 80. Any dev who changed APP_PORT to avoid a host
port clash would see the tunnel fail to start with a false "app not
ready" error after 2 minutes of retries.
@aquarion
aquarion marked this pull request as ready for review July 30, 2026 23:51
@aquarion
aquarion merged commit 68ae0ec into main Jul 30, 2026
7 checks passed
@aquarion
aquarion deleted the fix/cloudflared-healthcheck-port branch July 30, 2026 23:51
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