fix(providers): do not follow upstream redirects

The adapter client re-sent provider API key headers to any redirect target. The client now returns the 3xx response to the caller. A test pins this behaviour.
This commit is contained in:
2026-11-02 23:57:01 +00:00
parent 6d3c8bf9b7
commit 53a7fa74c1
2 changed files with 57 additions and 1 deletions
+8 -1
View File
@@ -231,7 +231,14 @@ func newAdapterHTTPClient(timeout time.Duration) *http.Client {
}
tr.MaxIdleConnsPerHost = adapterIdleConnsPerHost
tr.ResponseHeaderTimeout = timeout
return &http.Client{Transport: tr}
// Redirects are not followed: the client re-sends provider API key
// headers, and a hijacked redirect target would receive them.
return &http.Client{
Transport: tr,
CheckRedirect: func(*http.Request, []*http.Request) error {
return http.ErrUseLastResponse
},
}
}
// attemptRecorder is invoked once per upstream HTTP attempt a shared