Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure we remove X-Forward-* HTTP headers that can cause problems proxying API requests #3934

Merged
merged 3 commits into from
Sep 30, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/jetstream/passthrough.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,11 @@ func fwdCNSIStandardHeaders(cnsiRequest *interfaces.CNSIRequest, req *http.Reque
// Skip these
// - "Referer" causes CF to fail with a 403
// - "Connection", "X-Cap-*" and "Cookie" are consumed by us
// - "Accept-Encoding" must be excluded otherwise the transport will expect us to handle the encoding/compression
case k == "Connection", k == "Cookie", k == "Referer", k == "Accept-Encoding", strings.HasPrefix(strings.ToLower(k), "x-cap-"):
// - "Accept-Encoding" must be excluded otherwise the transport will expect us to handle the encoding/compression
// - X-Forwarded-* headers - these will confuse Cloud Foundry in some cases (e.g. load balancers)
case k == "Connection", k == "Cookie", k == "Referer", k == "Accept-Encoding",
strings.HasPrefix(strings.ToLower(k), "x-cap-"),
strings.HasPrefix(strings.ToLower(k), "x-forwarded-"):

// Forwarding everything else
default:
Expand Down