Skip to content

fix: bootstrap heartbeat uses request host instead of hardcoded localhost#564

Merged
itskai-dev merged 1 commit intomainfrom
link/fix-heartbeat-url
Mar 1, 2026
Merged

fix: bootstrap heartbeat uses request host instead of hardcoded localhost#564
itskai-dev merged 1 commit intomainfrom
link/fix-heartbeat-url

Conversation

@itskai-dev
Copy link
Collaborator

Problem

GET /bootstrap/heartbeat/:agent generates HEARTBEAT.md with hardcoded curl http://127.0.0.1:4445/heartbeat/.... On Fly.io or any remote deploy, these URLs are unreachable. A real user on reflectt-evi.fly.dev gets a heartbeat doc pointing at localhost.

Fix

Derive base URL from x-forwarded-proto/x-forwarded-host headers (set by Fly.io, Vercel, nginx, etc.) with fallback to Host header.

Result: curl https://reflectt-evi.fly.dev/heartbeat/myagent — correct for any deployment.

Testing

  • tsc --noEmit: 0 errors
  • 1 file, +6/-1 lines

…alhost

The bootstrap heartbeat template hardcoded 127.0.0.1:4445 in all
generated curl commands. On Fly.io or any non-localhost deploy,
the generated HEARTBEAT.md was useless — agents couldn't reach
the server at that address.

Now uses x-forwarded-proto/host headers (set by reverse proxies
like Fly.io) with fallback to request Host header.
@itskai-dev itskai-dev requested a review from ryancampbell as a code owner March 1, 2026 04:16
@itskai-dev itskai-dev merged commit c68528c into main Mar 1, 2026
9 of 10 checks passed
@itskai-dev itskai-dev deleted the link/fix-heartbeat-url branch March 1, 2026 04:18
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