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

After page.goto(), call response.request().redirectChain() to get the requests that preceded the final response in that resource’s redirect chain. Check that the navigation response is not null first. For ongoing traffic logs, listen for Puppeteer’s request and response events.

Get the redirect chain after navigation

Puppeteer resolves page.goto() with the response to the last redirect, not an array of every hop. The final response’s request exposes the preceding requests through redirectChain(). The array is empty if the resource was not redirected. For an HTTP-to-HTTPS redirect, for example, it includes the original HTTP request. See the Puppeteer redirectChain() API and Page.goto() API.

const response = await page.goto('http://example.com');

if (response) {
  const chain = response.request().redirectChain();
  console.log('Redirect count:', chain.length);
  console.log('Redirected-from URLs:', chain.map(request => request.url()));
} else {
  console.log('Navigation returned no response.');
}

The chain contains the requests preceding the final request; it does not include the final URL itself. To see the destination too, read response.url() or response.request().url().

Handle a null navigation response

Do not assume every page.goto() call returns an HTTP response. Puppeteer documents null for special cases such as navigating to about:blank or navigating to the same URL with a different hash. In those cases there is no response to inspect, so guard before calling response.request().

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

Log requests and responses while the page runs

Use page events when you need to observe network activity as it happens, rather than only inspect the navigation’s completed redirect chain. This runnable example logs all requests, responses, and request failures, then prints the main navigation’s chain:

const url = 'http://example.com';

page.on('request', request => {
  console.log('request', request.method(), request.url());
});

page.on('response', response => {
  console.log('response', response.status(), response.url());
});

page.on('requestfailed', request => {
  console.log('failed', request.url(), request.failure()?.errorText);
});

const response = await page.goto(url);
if (response) {
  const chain = response.request().redirectChain();
  console.log('navigation redirects', chain.map(request => request.url()));
}

Puppeteer listens for these events by default; attach listeners to observe them. A redirect completes the original request and then issues a new request. It is not itself a request failure. For a page-wide log, expect traffic from scripts, stylesheets, images, and other resources as well as the top-level document. Filter to navigation requests when that is all you need: request.isNavigationRequest() identifies requests that drive a frame’s navigation. See the HTTPRequest API and Puppeteer network logging guide.

Tell redirects apart from HTTP errors and request failures

A 404 or 503 is an HTTP response: the exchange completed, so it is not reported as requestfailed merely because the status is an error. Check response.status() to identify HTTP status codes. The requestfailed event instead signals a request-level failure, such as a timeout. A redirect also completes its original request; the browser then makes another request to the redirected URL.

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
  • Use redirectChain() to retrieve preceding request URLs for the completed navigation.
  • Use response.status() to inspect an HTTP response code, including 404 or 503.
  • Use requestfailed and request.failure() to diagnose transport or loading failures.

Cross-check a redirect visually in Chrome DevTools

For a manual check, open Chrome DevTools’ Network panel before reproducing the navigation. The panel records requests while it is open and shows status and initiator information; an HTTP redirect is labeled as a redirect initiator. This view is useful for understanding which request led to another, while Puppeteer’s chain is better suited to a programmatic list of predecessor URLs. See Chrome DevTools Network panel documentation.

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

When to use the lower-level Chrome DevTools Protocol

Puppeteer’s CDPSession can send raw Chrome DevTools Protocol commands and subscribe to protocol events. For ordinary redirect tracing, the higher-level HTTPRequest.redirectChain() and page events are sufficient. Avoid reaching into an HTTPRequest’s internal client as a shortcut: Puppeteer warns that direct access can break Puppeteer. Use raw protocol access only when you have a specific requirement the public APIs do not meet. See the CDPSession API.

Troubleshooting redirect tracing

response is null

Guard before reading response.request(). Special navigations such as about:blank and same-URL navigation with a different hash may return no response.

The redirect array is empty

An empty array means the resource chain represented by that request has no preceding redirect requests. Confirm that you are inspecting the final navigation response rather than an unrelated subresource, and print response.url() to verify the destination you reached.

The event log has many URLs

Page events include resource requests beyond the main document. Filter with request.isNavigationRequest() if you want navigation traffic only; use the final response’s chain when you only need the completed navigation’s redirect predecessors.

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

A 404 or 503 appears as a response, not a failure

That is expected: these are completed HTTP exchanges. Read response.status() for the status. Reserve requestfailed for request-level problems such as timeouts.

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

No redirect appears in a manual DevTools check

The Network panel records requests only while it is open. Open it before repeating the navigation, then inspect the request status and initiator columns.

Version note

The linked Puppeteer API and network-logging pages may show different documentation version labels as releases move. The API pages consulted for this workflow identify versions 25.12.0 for HTTPRequest, Page.goto(), and network logging, while the standalone redirectChain() page identifies 25.10.0. Check the documentation matching the Puppeteer version installed in your project.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If you need a website screenshot rather than Puppeteer’s redirect-event debugging, ScreenshotNeo is a one-request screenshot API. Its endpoint returns an image or PDF; it does not replace Puppeteer’s redirect-chain inspection.

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

Example using cURL (see the ScreenshotNeo API documentation):

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

ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before capture; each cleanup step can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits cost nothing, and the response reports the page verdict and billing status in headers. An MCP server provides screenshot tools for AI agents, and the free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000.

Sign up for ScreenshotNeo free: 1,000 screenshots a month, no card required.

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.

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