fix: restore auth stripping on redirect, keyed off AuthHeader

This commit is contained in:
AJ ONeal 2026-04-20 09:59:27 -06:00
parent 3feb248ce1
commit 4e8321af97
No known key found for this signature in database

View File

@ -121,6 +121,15 @@ func (c *Cacher) Fetch() (updated bool, err error) {
}
client := &http.Client{Timeout: timeout, Transport: transport}
if c.AuthHeader != "" {
// Strip auth before following any redirect — redirect targets (e.g.
// presigned S3/R2 URLs) must not receive our credentials.
authHeader := c.AuthHeader
client.CheckRedirect = func(req *http.Request, via []*http.Request) error {
req.Header.Del(authHeader)
return nil
}
}
resp, err := client.Do(req)
if err != nil {