Puppeteer Custom Headers

Is it possible to add custom headers in Puppeteer? I am trying to use a tls client, than needs two custom headers and wondering if its possible to use with puppeteer inside of OB2 .

attempting to modify a node.js snippet to work with this . Any help would be appreciated thanks!

INTERPRETER:NodeJS
INPUT 
BEGIN SCRIPT
// enable request interception
await page.setRequestInterception(true);
// add header for the navigation requests
page.on('request', request => {
  // Do nothing in case of non-navigation requests.
  if (!request.isNavigationRequest()) {
    request.continue();
    return;
  }
  // Add a new header for navigation request.
  const headers = request.headers();
            headers["poptls-url\”:\"https://somesite.com",
        			"poptls-proxy\”:\"http://ipuser:ippass@proxy:port"] = "1";
            request.continue({
                headers});
});
// navigate to the website
await page.goto("http://TLSIP:PORT");
END SCRIPT
ENDBLOCK

Hey, open an issue on github about this if you want and I will take a look about implementing it in the puppeteer support of OB2 directly without recurring to node.

1 Like