Skip to content

feat: forward request headers and add configurable host headers#194

Merged
alecthomas merged 1 commit intomainfrom
feat/host-header-forwarding
Mar 17, 2026
Merged

feat: forward request headers and add configurable host headers#194
alecthomas merged 1 commit intomainfrom
feat/host-header-forwarding

Conversation

@alecthomas
Copy link
Collaborator

@alecthomas alecthomas commented Mar 17, 2026

Summary

  • Handler now auto-forwards safe request headers to upstream, stripping hop-by-hop headers (RFC 7230). Fixes issues where upstream servers (e.g. ghcr.io) require headers like Accept from the original request.
  • Host strategy supports configurable static headers via headers config, useful for injecting auth (e.g. Authorization: Bearer QQ== for ghcr.io/Homebrew bottles).
  • Unified header filtering in httputil.FilterHeaders, replacing cache.FilterTransportHeaders.

Test plan

  • Unit tests for httputil.FilterHeaders covering transport headers, hop-by-hop headers, and case insensitivity
  • Handler tests for header forwarding, hop-by-hop stripping, and transform precedence
  • Host strategy tests for configurable headers
  • All existing tests pass, linter clean

🤖 Generated with Claude Code

… to host strategy

The handler now automatically forwards safe request headers to upstream,
stripping hop-by-hop headers per RFC 7230. This fixes issues where upstream
servers (e.g. ghcr.io) require headers like Accept from the original request.

The host strategy also supports configurable static headers, useful for
injecting auth headers (e.g. Bearer token for ghcr.io/Homebrew bottles).

Header filtering is unified in httputil.FilterHeaders, replacing the
previous cache.FilterTransportHeaders.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Claude Code <noreply@anthropic.com>
Ai-assisted: true
@alecthomas alecthomas requested a review from a team as a code owner March 17, 2026 04:01
@alecthomas alecthomas requested review from stuartwdouglas and removed request for a team March 17, 2026 04:01
@alecthomas alecthomas enabled auto-merge (squash) March 17, 2026 04:01
@alecthomas alecthomas merged commit 695f1e6 into main Mar 17, 2026
7 checks passed
@alecthomas alecthomas deleted the feat/host-header-forwarding branch March 17, 2026 04:02
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