Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk5 min

How to Continue a Puppeteer Request with Overrides

Enable Puppeteer request interception, apply only the overrides you need, and resolve every request safely—even when multiple handlers share a page.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Enable request interception, then call request.continue() with only the fields you want to change: headers, method, postData, or url. Every intercepted request must be continued, responded to, or aborted; otherwise it can remain stalled.

Basic pattern: continue a request with a header override

Turn interception on before the request you want to handle. This complete example adds a header to each request while preserving its existing headers:

As an Amazon Associate I earn from qualifying purchases.

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch();
  try {
    const page = await browser.newPage();

    await page.setRequestInterception(true);
    page.on('request', request => {
      if (request.isInterceptResolutionHandled()) return;

      const headers = {
        ...request.headers(),
        'x-example': 'value',
      };

      request.continue({ headers }).catch(error => {
        console.error('Could not continue request:', error);
      });
    });

    await page.goto('https://example.com', { waitUntil: 'domcontentloaded' });
  } finally {
    await browser.close();
  }
})();

The copied header object matters: passing a new object without copying the existing headers replaces them. Puppeteer reports header names in lower case. Its documented pattern also allows an undefined value to remove a header.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Which override should you use?

HTTPRequest.continue() accepts a ContinueRequestOverrides object. The optional fields are:

Field Use it to Important detail
headers Replace or modify request headers. Copy request.headers() first if you want to retain existing values; header names are lower case.
method Change the HTTP method for this request. Supply the intended method as an override; do not assume other request properties change automatically.
postData Set the request body data. request.postData() may not be available for long or not-readily-decoded data; use fetchPostData() for that case.
url Change the URL used for the request. Puppeteer says this changes the request URL; it is not a redirect.

Use only the fields relevant to the change. For example, to modify both a header and the URL, provide both in the same object: request.continue({ headers, url: 'https://example.com/other' }).

Make sure every intercepted request is resolved

After page.setRequestInterception(true), intercepted requests pause until they are continued, responded to, aborted, or completed using the browser cache. A handler that does not need to customize a particular request must still continue it.

Rank #2
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option
page.on('request', request => {
  if (request.isInterceptResolutionHandled()) return;

  if (request.url().includes('/api/')) {
    request.continue({ headers: { ...request.headers(), 'x-example': 'value' } });
  } else {
    request.continue();
  }
});

Enable interception before navigation or before the particular request starts. Calling request.continue() without interception enabled throws. Puppeteer documents these behaviors in its HTTPRequest.continue() API and Page.setRequestInterception() API.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Prevent duplicate resolution when handlers overlap

Multiple request listeners may be registered by your code or by libraries. Before resolving a request, check request.isInterceptResolutionHandled(). If your handler awaits asynchronous work, check again immediately before calling continue(), abort(), or respond(); another listener may have handled the request while your handler was waiting.

page.on('request', async request => {
  if (request.isInterceptResolutionHandled()) return;

  const shouldAddHeader = await decideWhetherToModify(request);

  // Another listener may have resolved it during the await.
  if (request.isInterceptResolutionHandled()) return;

  const headers = shouldAddHeader
    ? { ...request.headers(), 'x-example': 'value' }
    : request.headers();

  await request.continue({ headers });
});

Use the guard consistently in handlers that may share a page. A second attempt to resolve a request can fail because the request has already been handled.

When multiple listeners need priority control

Puppeteer supports cooperative interception when every resolving handler supplies a numeric priority. The highest priority wins. If actions tie, the order is abort ahead of respond, and respond ahead of continue. If even one handler omits a priority, legacy immediate resolution applies instead.

Rank #4
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • Brand: Wiley
  • Set of 2 Volumes
  • A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers
Mode How it behaves Choose it when
Legacy immediate resolution A handler resolves the request as soon as it calls a resolution method without a priority. You own the listeners or do not need them to weigh in together.
Cooperative priority resolution All resolving handlers pass numeric priorities; Puppeteer selects the winning action after considering them. Handlers need to participate in a shared decision.

For a continuation that simply passes the request along in cooperative mode, Puppeteer recommends the default priority, 0. Do not mix priority and no-priority calls if you expect cooperative behavior. See Puppeteer’s network interception guide for the handling model and resolution checks.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Common problems and fixes

  • continue() throws because interception is not enabled: call await page.setRequestInterception(true) before navigation or before the request is issued.
  • A page or resource appears to hang: inspect every request listener and ensure each intercepted request reaches a resolution path. Requests are paused until resolved, subject to browser-cache completion.
  • A request is resolved twice: guard with isInterceptResolutionHandled(); after any await, check again immediately before resolving.
  • Existing headers disappear: merge the desired changes into request.headers() instead of passing only the new header.
  • The URL change behaves unlike navigation redirection: a url override changes the intercepted request URL; Puppeteer explicitly does not describe it as a redirect.
  • POST data is missing: postData() can be unavailable when the body is too long or is not readily decoded. Use fetchPostData() where that applies.
  • Priority values do not produce the expected winner: confirm every listener resolving the request supplies a numeric priority. A no-priority resolution switches to legacy immediate handling.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Version and source notes

Puppeteer’s API pages identify HTTPRequest.continue() as version 25.12.0 and ContinueRequestOverrides as version 25.10.0. APIs can change between releases, so check the documentation matching the Puppeteer version installed in your project.

Or skip the browser setup

If you need screenshots rather than custom interception logic, ScreenshotNeo is a website screenshot API and MCP server. Its one-call API returns a screenshot or PDF:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo API documentation for options. Cookie banners are accepted and removed before capture, along with supported newsletter popups and chat widgets; bot checks, blank pages, failed loads, timeouts, and cache hits are not billed. Its MCP server lets AI agents use take_screenshot, get_page_info, and capture_pdf. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000.

Sign up for ScreenshotNeo’s free plan.

Frequently Asked Questions

Can I change a request URL with `request.continue()`?

Yes. Pass a `url` override; Puppeteer specifies that this changes the request URL and is not a redirect.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Where can I check request body data if `postData()` is unavailable?

Puppeteer’s request reference advises using `fetchPostData()` when the body is too long or not readily decoded.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.