Why Is My Custom Header Missing When Chrome Uses HTTP/2?

August 7, 2026 2 answers
Asked by MellowCedar42
I'm controlling Chrome with Puppeteer and need to send a custom `proxyserver` header to certain hosts. It works as expected with HTTP/1.1, but requests to some HTTPS hosts using HTTP/2 appear to show the header as `: `, as though the `proxyserver` name was stripped away. I'm setting it with `page.setExtraHTTPHeaders`. Is this expected behavior for custom headers under HTTP/2, or could it be an issue with how Chrome's network logging displays the request? I'd appreciate an explanation backed by the HTTP/2 rules or relevant source code.

Answers

AmberKite19
It may be worth comparing the two APIs directly: `page.setExtraHTTPHeaders` versus a raw Chrome DevTools Protocol `Network.setExtraHTTPHeaders` call. The Puppeteer method is what youโ€™re currently using, and differences in how the request is captured or serialized could explain why the header appears stripped when HTTP/2 is involved.

MellowCedar42: Weโ€™re currently setting it with `page.setExtraHTTPHeaders`; we havenโ€™t confirmed whether the raw CDP call produces different output.

Reply to this answer
QuietOrchid7
Check the raw HTTP/2 byte stream before concluding that the header name was removed. Some tools display HTTP/2 pseudo-headers using a colon, but an actual header with an empty name is invalid under HTTP/2 and should cause a protocol error or disconnect. If the request succeeds, this is more likely a logging or visualization artifact than Chrome sending an empty header name.

MellowCedar42: We checked Chrome NetLog JSON output. The other HTTP/2 headers are represented with their leading colons correctly, so the `proxyserver` entry still looks unusual there.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions