I am writing a Chrome Extension which adds a request header. My code seems to work as expected but on some requests, Chrome says Provisional headers are shown, showing only the Referer
and User-Agent
:
I have checked "Disable cache" in the network inspector, and "hard" reloaded the page multiple times with a cache clear. Even with the extension disabled, I see this happen on the same certain requests when made by a parent webpage, but it is worrying that I do not see my header there when I would expect to. For example, testing on twitter.com, this request ( https://abs.twimg.com/a/1538144154/img/t1/web_sprite.png ) has the issue I'm describing, but not when loaded directly with the link in the address bar.
I'm testing my extension on bbc.co.uk, wikipedia.org and twitter.com, and each have a few requests which do this every time. My extension code in case it's relevant:
const setCustomReqHeader = (details) => {
if (bCustomHeader) {
const oNewHeaderEntry = {name: sHeaderName, value: sHeaderValue}
details.requestHeaders.push(oNewHeaderEntry)
return {requestHeaders: details.requestHeaders}
}
return {requestHeaders: details.requestHeaders};
}
chrome.webRequest.onBeforeSendHeaders.addListener(
setCustomReqHeader,
{urls: ["all_urls"]},
["blocking", "requestHeaders"]
);
Thanks to anyone who can help!