Skip to content

Fix healthcheck host mismatch in reverse-proxy setups#159

Open
TylonHH wants to merge 1 commit intoLinkStackOrg:mainfrom
TylonHH:codex/fix-healthcheck-host-header
Open

Fix healthcheck host mismatch in reverse-proxy setups#159
TylonHH wants to merge 1 commit intoLinkStackOrg:mainfrom
TylonHH:codex/fix-healthcheck-host-header

Conversation

@TylonHH
Copy link
Copy Markdown

@TylonHH TylonHH commented Apr 22, 2026

Summary

  • replace hardcoded curl -f http://localhost healthcheck with a host-aware request
  • use Host: ${HTTP_SERVER_NAME:-localhost} so Laravel host trust checks match runtime domain config
  • keep check local to container via http://127.0.0.1/

Problem

In reverse-proxy/swarm deployments, LinkStack may trust only the configured app domain host. A healthcheck request with Host: localhost can fail (e.g., 404/500), marking the container unhealthy and causing restart loops.

Change

HEALTHCHECK CMD curl -fsS -A "HealthCheck" -H "Host: ${HTTP_SERVER_NAME:-localhost}" http://127.0.0.1/ >/dev/null || exit 1

Impact

  • keeps current behavior for default localhost setups
  • fixes false-negative healthchecks when HTTP_SERVER_NAME is set
  • avoids avoidable unhealthy restarts under orchestrators

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