RedirectPath.dev
Tools

Troubleshooting · Practical guide

How to find and fix redirect chains and loops

A chain takes several redirects to reach a destination. A loop returns to a previous request and cannot finish normally. Capture the failing starting URL and the sequence of responses before changing rules: a browser error alone does not identify the layer or condition responsible.

Resolve competing apex and www rules

Suppose the CDN sends example.com to www.example.com, while the application sends www back to the apex. Each rule looks reasonable alone; together they repeat the same two requests. The trace below keeps /docs unchanged, so hostname normalization is the first condition to investigate.

Choose the intended public hostname and make the two layers agree. If www is canonical, keep the apex-to-www redirect and remove or correct the application’s reverse rule. Confirm the application serves /docs at the chosen host before deploying. Changing every destination to the homepage would stop this example while losing the requested content.

GET https://example.com/docs
301 Location: https://www.example.com/docs

GET https://www.example.com/docs
301 Location: https://example.com/docs

The next request repeats the starting URL.
  1. Match each Location response to a CDN rule, virtual host or application redirect using configuration and request logs.
  2. Choose the canonical hostname and correct the conflicting rule while preserving the intended resource.
  3. Trace both supported hosts again, including HTTP, HTTPS and an existing deep link.

Reference: MDN: redirect loops

Read the status, destination and stop reason together

Read each response in order and note which part changes: scheme, hostname, path or query. A route can progress through several distinct URLs without looping. RedirectPath follows up to ten HTTP redirects; reaching its limit, a timeout or a blocked destination is not proof of a cycle.

The macOS/Linux command below uses GET, follows at most ten redirects and stops after thirty seconds. Each header block belongs to a response in the journey. A redirect-limit error means the configured limit was reached; inspect the sequence instead of removing the limit. curl -I tests HEAD and may produce different behavior.

RedirectPath redacts query values. Two displayed URLs can therefore look identical while their original values differ. Use the reported stop reason and inspect harmless test values locally when needed. curl output is not redacted and may include cookies or sensitive destinations.

curl -q -sS -L --max-redirs 10 --max-time 30 \
  -D - -o /dev/null \
  --write-out '\nLast URL: %{url_effective} (%{http_code})\n' \
  'https://example.com/docs'
Read the status, destination and stop reason together
Observed resultMeaningNext step
Endpoint reached after several hops A finite chain, even if unnecessarily long. Map old links directly to their equivalent destination.
A previous original URL repeats A detected loop; redacted URLs alone cannot prove this. Find the two rules that return to the earlier step.
Redirect limit reached The trace stopped at its safety limit; a loop is not established. Inspect the recorded rules and shorten the path.
Timeout, blocked target or unusable Location The remaining path is unknown. Investigate that specific stop reason first.

Reference: curl: redirects, response headers and limits

Map each unexpected hop to its rule

List the layers in request order: CDN, load balancer, web server and application. For each unexpected response, find the matching hostname and path rule and correlate a controlled request with its logs. A Server header is a clue about infrastructure, not proof of which layer generated Location.

Check the actual virtual host selected by the public hostname. An edit to the default server or another hostname will not repair a different matching server. If TLS terminates at a proxy, compare the public scheme with the scheme the application trusts before changing its HTTPS redirect.

Map each unexpected hop to its rule
Trace patternLikely conflict to inspectEvidence to collect
example.com → www.example.com → example.com Opposing hostname-normalization rules. The host condition and Location emitted by each layer.
/docs → /docs/ → /docs Web-server slash rule versus application route convention. The matched route and the rule adding or removing the slash.
The same public HTTPS URL redirects to itself Incorrect scheme recognition behind TLS termination. Transport to the origin and trusted forwarded-scheme handling.

Reference: Nginx: request and virtual-server selection

Shorten content moves without changing their meaning

For a renamed article, replace /old-guide → /guides/old-name → /guides/new-name with a direct mapping from the old URL to its equivalent final article where practical. Update internal links and sitemap entries you control. Do not send unrelated retired pages to one homepage simply to produce a successful status.

Keep steps that serve a requirement, including authentication and a planned HTTPS transition. Agree on one trailing-slash convention for each route family before removing a normalization rule. Directory-backed resources and application routes may need different handling. Check required query parameters locally with harmless values, rather than blindly discarding the query string.

Reference: Google Search Central: redirect mapping and chains

Retest the original links and browser journey

Keep the failing source URLs as regression cases. A direct request to the final destination bypasses the rules being repaired. RedirectPath uses GET without cookies or JavaScript and does not follow HTML meta refresh. A browser-only “too many redirects” error needs a separate trace of the real session. Cookies, authentication and cached redirects can change that journey. Clearing cookies may help diagnose a browser-specific problem, but does not repair conflicting server rules.

  1. Repeat the original source URL and each supported HTTP/HTTPS and apex/www variant.
  2. Check the affected slash variants, a deep link and a harmless required query parameter.
  3. Confirm the final status and content match the intended resource; no relevant request should repeat indefinitely.
  4. In browser DevTools, enable Preserve log before reproducing login or navigation. Inspect cached redirects, cookies and script-driven changes if its path differs.
  5. After deployment, recheck the public route through the CDN and confirm that an older cached redirect is not still being served.

Reference: Chrome DevTools: preserve and inspect network requests

Keep reading

Related guides

All guides & reference
Quick reference

HTTP status code reference for redirects and endpoints

Compare 301, 302, 303, 307 and 308, then interpret common endpoint errors and redirect stop reasons.

Open reference