mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
## 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