#1615·chromedp

`Network.SetExtraHTTPHeaders` with `Authorization` header forwarding to all external subrequests

Author: KieranPCreated Feb 8, 2026Updated Mar 17, 2026

Using Network.SetExtraHTTPHeaders is setting headers, not only for the page being loaded, but all sub-requests on that page (JS, CSS, images, etc). When these subrequests are from the same host, that's all good. But when loading external resources (such as images hosted on AWS S3), passing along some headers like Authorization is causing AWS to reject the request.

Ideally, SetExtraHTTPHeaders would only send the provided headers along to sub-requests that share the same host as the initial request.

I understand there is probably reluctance to change the existing API; might a new API be considered, such as Network.SetHTTPHeaders(host, headers)

e.g.

Network.SetHTTPHeaders('something.com', { 'Authorization': 'Bearer .....' })

That way, it only sends those headers if the request host matches.