Skip to content

Discard Caddy's own diagnostics in front of the relay - #80

Merged
frahlg merged 2 commits into
mainfrom
fix/relay-caddy-discard-diagnostics
Oct 12, 2026
Merged

frahlg merged 2 commits into
mainfrom
fix/relay-caddy-discard-diagnostics

Conversation

@frahlg

@frahlg frahlg commented Oct 12, 2026

Copy link
Copy Markdown
Member

Problem

Caddy's global log on the relay host goes to /var/log/caddy/caddy.log at ERROR level with no filter (relay/deploy/Caddyfile). Two kinds of record end up there:

  • A proxy error names the request URI, which carries the rendezvous handle, next to the client address.
  • Go's "TLS handshake error from " puts the address in the message text itself. A field filter cannot reach it.

The iOS App Store work (srcfl/ftw-app#13) found this while it filled in the App Privacy answers. With this log, the honest answer would have to declare "Other Diagnostic Data". Fredrik chose to remove the addresses instead.

Change

  • The global log block now uses output discard, as escrow/deploy/Caddyfile already does and for the same reason. A filter only covers the fields somebody thought of.
  • The site access log stays. Its filter already deletes request>uri, request>headers, request>remote_ip and request>client_ip.
  • relay/deploy/caddyfile.test.ts is new and holds both rules:
    • exactly two log blocks;
    • the global block discards;
    • the access log deletes the four fields;
    • no log goes to stdout or stderr.
  • A changeset is included.

Cost: there is no Caddy log to read when a certificate stops renewing. An outside curl -sI https://relay.ftw.energy/healthz covers that.

Evidence

  • The new test fails against the old Caddyfile (discards Caddy's own diagnostics) and passes against the new one.
  • npm run verify: 105 files passed and 1 skipped; 1062 tests passed and 1 skipped; svelte-check reports 0 errors; the build passed.
  • Not run: Caddy itself. No local Caddy binary was available. Validate it on the host before you reload.

After merge (operator, on the relay host)

  1. Deploy as usual, then run docker compose exec caddy caddy validate --config /etc/caddy/Caddyfile.
  2. Remove the old diagnostics, which may hold addresses and handles: docker compose exec caddy sh -c 'rm -f /var/log/caddy/caddy.log*'.
  3. Check from outside: curl -sI https://relay.ftw.energy/healthz.

🤖 Generated with Claude Code

frahlg and others added 2 commits October 12, 2026 19:14
Caddy's global log on the relay host went to a rotating file at ERROR
level with no filter. A proxy error there names the request URI, which
carries the rendezvous handle, beside the client address. Go's "TLS
handshake error from <address>" puts the address in the message text,
where a field filter cannot reach it.

Discard that log, as the escrow already does. The site access log stays:
its filter already deletes the URI, the headers and both address fields.
A new test holds both rules and fails against the old file.

The cost is no Caddy log when a certificate stops renewing; an outside
check of /healthz covers that.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-12T17:18:56.292948Z 7cc2f0e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
ftw-webapp 7cc2f0e Commit Preview URL

Branch Preview URL
Oct 12 2026, 05:16 PM

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7cc2f0e49f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread relay/deploy/Caddyfile
# are discarded, which is a shape rather than a list of fields.
#
# What that costs: no Caddy log to read when a certificate stops renewing.
# `curl -sI https://relay.ftw.energy/healthz` from outside covers it end

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Use GET for the external health check

When an operator adopts this command as the replacement for the discarded diagnostics, it never receives the health endpoint's successful response: curl --manual documents that HTTP -I uses HEAD, while RelayServer.start() accepts /healthz only when req.method === 'GET' and otherwise returns 426. This can produce a permanent false failure in monitoring; use the GET command already documented in relay/deploy/README.md or add HEAD handling to the endpoint.

Useful? React with 👍 / 👎.

@frahlg
frahlg merged commit 303cfb2 into main Oct 12, 2026
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.

1 participant