Internal Redirect Chain Watch avatar

Internal Redirect Chain Watch

Pricing

from $1.00 / 1,000 redirect regression reporteds

Go to Apify Store
Internal Redirect Chain Watch

Internal Redirect Chain Watch

Detects multi-hop internal redirect chains on a public HTTPS site and reports when redirect depth grows between scheduled runs.

Pricing

from $1.00 / 1,000 redirect regression reporteds

Rating

0.0

(0)

Developer

Practical AI Lab

Practical AI Lab

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

9 days ago

Last modified

Features

Limited permissions

Share

Finds multi-hop internal redirect chains (A → B → C → …) on a public HTTPS website and tells you when the redirect depth of a URL grows between runs. Every finding carries the source URL, where it was found (sitemap file or page), each hop with its HTTP status, the final URL and a timestamp.

It is a monitoring tool, not a general crawler: it inspects a small, bounded sample of URLs on every run and compares that sample with the baseline stored from earlier runs.

Who it is for

  • SEO and web teams who release site changes (migrations, URL rewrites, CMS or CDN rules) and want to catch redirect chains that quietly get longer.
  • Agencies that need a scheduled, evidence-backed check per client domain.

How it works

  1. Validates startUrl: public HTTPS site root only. Localhost, IP addresses, internal names, credentials, non-default ports, paths and query strings are rejected. The host's DNS answer must be public addresses.
  2. Reads robots.txt first and obeys it (wildcards, $, longest match, Crawl-delay). If robots.txt is unreachable, returns 401/403/5xx, or disallows the start page, the run fails and nothing else is requested.
  3. Reads sitemaps (from Sitemap: lines, otherwise /sitemap.xml) with limits on file count, file size (2 MB), index nesting and URL count. XML with DTD/entity declarations is rejected.
  4. Traces each selected URL manually, one redirect at a time. Only same-origin HTTPS hops are followed. Cross-origin, non-HTTPS or unsafe redirect targets stop the chain and are never requested.
  5. Optionally follows a few same-origin links found on the start page and sitemap pages (one level only).
  6. Compares with the per-domain baseline in a key-value store and writes results.

Input

Only startUrl is required. Copy this to try it (replace the domain with a site you are allowed to monitor):

{
"startUrl": "https://example.com/"
}

Optional limits (defaults in brackets): maxPages [40], maxSitemapUrls [300], maxSitemapFiles [5], maxLinksPerPage [10], maxRedirectHops [5], minDepthIncrease [1], requestDelayMillis [500], stateStoreName [pal-redirect-chain-baselines], resetBaseline [false].

Output

Results go to the default dataset (JSON/CSV/Excel export from the Apify Console) and, as CSV, to the key-value store key REDIRECT_CHANGES_CSV. The run summary is also stored as OUTPUT.

status (in RUN_SUMMARY)Meaning
BASELINE_CREATEDFirst run for this domain (or resetBaseline). Existing multi-hop chains are listed as BASELINE_CHAIN records. Never billed.
CHANGES_DETECTEDAt least one REDIRECT_CHANGE record.
NO_CHANGESNothing changed in URLs inspected both times. Never billed.

Change types: NEW_MULTI_HOP_CHAIN (2+ internal hops on a URL not inspected before), DEPTH_INCREASED (depth grew by at least minDepthIncrease and is now 2+), DEPTH_DECREASED (a chain got shorter; informational).

Record shape (placeholder values, for illustration only):

{
"recordType": "REDIRECT_CHANGE",
"changeType": "DEPTH_INCREASED",
"sourceUrl": "https://example.com/old-page",
"foundOn": "https://example.com/sitemap.xml",
"discoveredVia": "sitemap",
"previousDepth": 1,
"currentDepth": 3,
"previousChain": ["https://example.com/old-page", "https://example.com/new-page"],
"currentChain": ["https://example.com/old-page", "https://example.com/step-2", "https://example.com/step-3", "https://example.com/new-page"],
"hops": [{"url": "https://example.com/old-page", "status": 301, "location": "https://example.com/step-2"}],
"finalUrl": "https://example.com/new-page",
"finalStatus": 200,
"endReason": "final",
"previousCheckedAt": "2026-01-01T00:00:00+00:00",
"checkedAt": "2026-01-08T00:00:00+00:00",
"billable": true
}

endReason values: final, loop, max_hops_reached, cross_origin_stopped, non_https_stopped, unsafe_location_stopped, robots_blocked, redirect_without_location.

Scheduling

Create an Apify Schedule or Task for the same input, for example weekly or after each release. Keep the default stateStoreName: baselines live in a named key-value store, one entry per domain (BASELINE_<host>), so they survive between cloud runs. The run's own default store does not persist on the platform, so leaving stateStoreName empty only makes sense for local runs. Use resetBaseline after an intentional large restructuring to start over.

Billing event (not configured here)

The code calls charge() with the event redirect-regression-reported, once per NEW_MULTI_HOP_CHAIN or DEPTH_INCREASED record, at most 25 per run. Baseline runs, NO_CHANGES runs, improvements, partial page errors and failed runs emit no event. Events are sent only after results and the new baseline are saved. This project defines no price and no payable plan; that is decided separately.

Limitations and sample-size caveats

  • A sample, not an audit. Only up to maxPages URLs (max 200) are traced per run: the start page, the first sitemap URLs in document order, then links from those pages. A clean report does not mean the site has no chains.
  • Comparisons need overlap. A depth change is detected only for a URL inspected in both runs. If the sitemap order or links change, a URL may be reported as new even though its chain is old. Treat NEW_MULTI_HOP_CHAIN as "first seen", not "newly created". The baseline keeps up to 1,500 URLs; the oldest are dropped first and entries may be stale (see previousCheckedAt).
  • Link discovery is shallow. Links come only from the start page and sitemap pages; JavaScript-rendered links, forms and non-HTML pages are not seen. Gzipped sitemaps (.gz) are skipped.
  • Depth is a lower bound when a chain stops at max_hops_reached, at a robots_blocked target, or at a redirect that leaves the origin or is not HTTPS (those are reported, not followed).
  • Incomplete pages are not compared. Timeouts, HTTP 429 and 5xx responses make a URL incomplete; it is counted in pagesIncomplete and excluded from comparison and from the baseline update, so throttling cannot create false regressions. If every URL is incomplete the run fails.
  • Single-pass observation. A redirect rule that varies by user agent, cookie, country or time is seen as the crawler saw it once. Intermittent chains can appear and disappear.
  • robots.txt: the crawler identifies as PALRedirectChainWatch. Pages blocked for it are skipped and counted in pagesSkippedByRobots. Only the host's own robots.txt is considered.
  • DNS rebinding: the host's address is verified once before requests; the HTTP client then resolves it again. Redirects can never leave the origin, which limits exposure, but this is not a pinned-IP guarantee.
  • Not collected: page text, email addresses, phone numbers, forms or cookies. URLs containing @ or an encoded @ are skipped so addresses in query strings are not stored.
  • No authentication, proxies, headless browser or external services are used. Request pacing defaults to 500 ms (or the site's Crawl-delay, up to 10 s), so a full 200-URL run with long chains can take several minutes.

Local development

Tests run offline with mocked HTTP (httpx.MockTransport) and need httpx only:

python -m unittest discover -s tests -t .