Skip to content

fix(aibridge): strip proxy headers from bridge requests to fix Bedrock SigV4 signing (#26019)#26054

Open
github-actions[bot] wants to merge 1 commit into
release/2.33from
backport/26019-to-2.33
Open

fix(aibridge): strip proxy headers from bridge requests to fix Bedrock SigV4 signing (#26019)#26054
github-actions[bot] wants to merge 1 commit into
release/2.33from
backport/26019-to-2.33

Conversation

@github-actions
Copy link
Copy Markdown

@github-actions github-actions Bot commented Jun 4, 2026

Backport of #26019

Original PR: #26019 — fix(aibridge): strip proxy headers from bridge requests to fix Bedrock SigV4 signing
Merge commit: b7635b5
Requested by: @dannykopping

…k SigV4 signing (#26019)

## Problem

On bridge routes, aibridge acts as a client and originates new outbound
requests via the SDK. Proxy headers (`X-Forwarded-For`,
`X-Forwarded-Host`, etc.) from the inbound client request were forwarded
on the outbound request. The SigV4 signer signs all headers present, so
any in-transit modification by an egress proxy (e.g. appending an IP to
`X-Forwarded-For`) invalidated the signature, causing AWS Bedrock to
reject the request with:

> 403: "The request signature we calculated does not match the signature
you provided."

## Changes

- Strip proxy headers in `PrepareClientHeaders` on bridge routes
- Add unit test for proxy header stripping in `client_headers_test.go`
- Add integration test that verifies SigV4 signature remains valid after
an egress proxy modifies headers in transit
- Add integration test that verifies passthrough routes still set
forwarded headers correctly

Related to internal [Slack
thread](https://codercom.slack.com/archives/C096PFVBZKN/p1779919049215969).

> 🤖 Generated by Coder Agents, modified and reviewed by @ssncferreira

(cherry picked from commit b7635b5)
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.

3 participants