Skip to content

feat(stack): forward client address headers to upstreams (CLI-2823) - #7345

Merged
7ttp merged 2 commits into
developfrom
7ttp/cli-2823-stack-the-gateway-sets-no-x-forwarded-for-or-x-real-ip-so
Oct 27, 2026
Merged

7ttp merged 2 commits into
developfrom
7ttp/cli-2823-stack-the-gateway-sets-no-x-forwarded-for-or-x-real-ip-so

Conversation

@7ttp

@7ttp 7ttp commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

TL;DR

adds X-Forwarded-For and X-Real-IP to what the stack gateway sends upstream, so edge functions can see who is calling them

whats introduced?

the gateway now appends the client address to any incoming X-Forwarded-For chain and sets
X-Real-IP to the client address, the same way the legacy backend does

both the http path and the websocket upgrade path send them

a client sent X-Real-IP is always replaced or dropped, so callers cant spoof it through the gateway

visual rep
flowchart LR
  subgraph before
    A1[client] --> B1[stack gateway]
    B1 --> C1[edge function sees no client address]
  end
  subgraph now
    A2[client] --> B2[stack gateway]
    B2 --> D2{peer address known}
    D2 -->|yes| E2["append client to X-Forwarded-For<br/>set X-Real-IP to client"]
    D2 -->|no| F2[drop client sent X-Real-IP]
    E2 --> G2[http and websocket upstreams]
    F2 --> G2
    G2 --> H2[edge function sees the caller]
  end
Loading

ref

@7ttp 7ttp self-assigned this Oct 27, 2026
@7ttp
7ttp requested a review from a team as a code owner October 27, 2026 11:01

@github-actions github-actions Bot 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.

🤖 AI Review

Both independent reviews reported no findings. Verified the changed header handling, HTTP and WebSocket callers, and integration coverage against the surrounding code; no actionable issues found. Tests were not run because dependencies are unavailable.

Findings

No issues found.

Stats

Claude findings: 0 · Codex findings: 0 · Confirmed: 0 · Refuted: 0 · Uncertain: 0


Models: claude-opus-5-5 + gpt-6.1-sol · Trigger: auto · Workflow run

This review runs once per PR. A maintainer can request another with a /ai-review comment.

@Coly010 Coly010 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.

LGTM, thanks!

@7ttp
7ttp added this pull request to the merge queue Oct 27, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 27, 2026
@7ttp
7ttp added this pull request to the merge queue Oct 27, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 27, 2026
@7ttp

7ttp commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

left the queue twice on the start.slim-images ghcr 429 flake, nothing from this diff

@7ttp
7ttp enabled auto-merge October 27, 2026 17:25
@7ttp
7ttp added this pull request to the merge queue Oct 27, 2026
Merged via the queue into develop with commit 99b4540 Oct 27, 2026
43 checks passed
@7ttp
7ttp deleted the 7ttp/cli-2823-stack-the-gateway-sets-no-x-forwarded-for-or-x-real-ip-so branch October 27, 2026 17:31
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.

stack: the gateway sets no X-Forwarded-For or X-Real-IP, so Edge Functions cannot see the client IP

2 participants