Skip to content

Preserve all X-Forwarded-For header lines - #581

Merged
geofffranks merged 1 commit into
developfrom
fix/xff-multi-header-preserve
Aug 17, 2026
Merged

Preserve all X-Forwarded-For header lines#581
geofffranks merged 1 commit into
developfrom
fix/xff-multi-header-preserve

Conversation

@hoffmaen

@hoffmaen hoffmaen commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Fixes #580

Summary

Restores handling of X-Forwarded-For when it arrives as multiple header lines by joining Header.Values("X-Forwarded-For") instead of reading only the first line via Header.Get, a regression introduced with the DirectorRewrite migration in #573. Fixes #580.

Backward Compatibility

Breaking Change? No

Note on AI Usage

Parts of this code and tests were developed with assistance from Claude Code (claude-opus-4.8).

@geofffranks geofffranks left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Correct fix, LGTM.

Header.Getstrings.Join(Header.Values(…), ", ") is the standard Go idiom for folding multi-line headers and directly addresses the regression from the Director→Rewrite migration in #573. No behavioral change for the single-header case. The new test cleanly reproduces the bug.

Minor note (not a blocker): X-Forwarded-Proto and X-Forwarded-Host at proxy.go:150,153 use the same Header.Get pattern. Less likely to arrive as multiple lines in practice, but worth a follow-up issue if that's plausible in your deployment topology.

@github-project-automation github-project-automation Bot moved this from Inbox to Pending Merge | Prioritized in Application Runtime Platform Working Group Aug 17, 2026
@geofffranks
geofffranks merged commit 491c5ea into develop Aug 17, 2026
1 check passed
@geofffranks
geofffranks deleted the fix/xff-multi-header-preserve branch August 17, 2026 16:02
@github-project-automation github-project-automation Bot moved this from Pending Merge | Prioritized to Done in Application Runtime Platform Working Group Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

X-Forwarded-For loses entries when the header arrives as multiple lines

2 participants