HTTP Status Codes

What is a 508 Loop Detected?

A 508 Loop Detected is an HTTP status code that means the server detected an infinite loop while attempting to process a request. Rather than continuing to process a request that will never resolve, the server stops, returns the 508, and prevents the loop from consuming resources indefinitely.

It belongs to the 5xx class of HTTP status codes, which all indicate server-side conditions. Unlike a 500 error which signals a generic unexpected failure, or a 503 error which signals temporary unavailability, the 508 is specific, it means the server identified a circular reference or recursive process that has no exit condition and cannot complete.

The 508 is relatively rare in everyday web browsing. Most people encounter loop-related errors through the client-side ERR_TOO_MANY_REDIRECTS browser error rather than a 508 response directly. Understanding the difference between the two, and understanding where 508 fits in the broader context of redirect loops and server architecture, is important for anyone managing complex redirect configurations or web infrastructure.


How a 508 error happens

A 508 occurs when the server detects that processing a request has entered a loop, a sequence of operations that keeps cycling back to its starting point with no way to exit. The server recognises this pattern and returns the 508 rather than continuing indefinitely.

The most common causes are:

  • Circular redirect configurations: when redirect rules on a server create a loop where URL A redirects to URL B which redirects back to URL A, or a longer chain that eventually circles back to its origin. If the server detects this loop internally before the browser does, it returns a 508. This is distinct from the client-side ERR_TOO_MANY_REDIRECTS error, which occurs when the browser detects the loop after following too many hops.

  • WebDAV circular references: the 508 was originally defined in the context of WebDAV, a set of HTTP extensions for collaborative document management. In WebDAV environments, circular references can occur when a resource contains a reference to itself or to another resource that references it back, creating an infinite traversal loop during operations like copying or moving resource trees.

  • Recursive server-side processing: web applications with recursive logic that lacks a proper base case or exit condition can trigger a 508 when the recursion depth becomes infinite. This is more commonly seen as a 500 error in practice, but servers that specifically detect the loop pattern may return a 508.

  • Misconfigured reverse proxies: in architectures where a reverse proxy forwards requests to backend servers, circular proxy configurations, where the proxy forwards to a server that forwards back to the proxy, can trigger a 508 if the loop detection is implemented at the proxy layer.


508 vs ERR_TOO_MANY_REDIRECTS

These two errors are related but occur at different points in the request cycle and should be understood separately.

A redirect loop occurs when redirect rules create a circular chain, URL A redirects to URL B which redirects back to URL A, for example. When this happens, either the server or the browser will eventually stop the cycle.

ERR_TOO_MANY_REDIRECTS is a client-side browser error. The browser follows the redirect chain hop by hop (following the Location header from each response) until it hits its internal redirect limit, typically around 20 hops. At that point the browser stops, gives up, and displays the ERR_TOO_MANY_REDIRECTS error to the visitor. The server never detected the loop, it was responding correctly to each individual request. The browser is the one that recognised the pattern and stopped.

A 508 Loop Detected is a server-side response. The server itself detects the loop during request processing and returns the 508 before the browser has had a chance to follow multiple hops. This requires the server or application to have loop detection logic built in, it actively monitors the processing cycle and intervenes when it identifies a circular pattern.

In practice, redirect loops are far more commonly surfaced as ERR_TOO_MANY_REDIRECTS browser errors than as 508 responses, because most standard web server configurations do not implement proactive loop detection. The 508 is more common in WebDAV environments and sophisticated proxy setups where loop detection is explicitly built into the infrastructure.


508 and redirect management

For anyone managing URL redirects across multiple domains, the 508 is a reminder of why redirect rule hygiene matters. Redirect loops are one of the most disruptive configuration errors in redirect management, they make affected URLs completely inaccessible and can be difficult to diagnose if the loop involves multiple domains or passes through several redirect hops before circling back.

Common redirect loop scenarios that can trigger 508s or ERR_TOO_MANY_REDIRECTS include:

  • WWW to non-WWW loops: a server configured to redirect www.example.com to example.com while simultaneously redirecting example.com back to www.example.com. This is one of the most common redirect loop mistakes and is easy to create accidentally when www and non-www redirect rules are configured in multiple places.

  • HTTP to HTTPS loops: a server configured to redirect HTTP to HTTPS at the same time as another rule redirects HTTPS back to HTTP, or when a CDN handles HTTPS termination but the origin server is also configured to redirect HTTP to HTTPS, causing the origin to redirect requests it receives from the CDN.

  • Wildcard redirect conflicts: a global wildcard redirect that catches all URLs including the destination it is redirecting to, causing the destination to immediately redirect back through the same rule.

  • Canonical URL mismatches: redirect rules designed to enforce a canonical URL structure that conflict with each other, each rule trying to correct what the other has done.


508 and SEO

From an SEO perspective, a 508 has similar implications to a redirect loop detected by a browser. Any URL that returns a 508 or triggers a loop is completely inaccessible, Googlebot and other web crawlers cannot follow a loop to its conclusion any more than a browser can.

When a crawler encounters a redirect loop or a 508 on a URL, it cannot index the content at that URL. If the URL previously had rankings and SEO equity, those begin to erode as the URL becomes persistently inaccessible. Link juice from backlinks pointing to a looping URL goes nowhere. Crawl budget is wasted on requests that never resolve.

Resolving redirect loops quickly is one of the most high-priority technical SEO fixes. Unlike a 404 where at least the server responds definitively, a loop leaves the URL in a state of perpetual unresolvability that is actively harmful to both users and crawlers.


How to diagnose a 508 or redirect loop

Diagnosing a redirect loop requires tracing the full sequence of redirects from the original URL to find where the circular reference occurs.

  • Browser developer tools: the Network tab in browser developer tools shows every redirect hop in sequence, including the status code and Location header of each response. Following this chain manually often reveals exactly where the loop begins.

  • curl command line: the curl tool with the -L flag follows redirects and the -v flag shows verbose output including all response headers. Running curl -Lv https://example.com traces the full redirect chain and makes circular references immediately visible.

  • Redirect checking tools: dedicated redirect checker tools trace chains automatically and flag loops, showing every hop, status code, and destination in sequence. These are faster than manual tracing for complex chains involving multiple domains.

  • Server error logs: Apache and Nginx error logs record 508 responses and in some configurations provide additional context about where the loop was detected. Reviewing logs immediately after a 508 is reported can accelerate diagnosis.

  • Review recent changes: redirect loops almost always appear immediately after a configuration change. Reviewing what redirect rules were added or modified before the loop appeared is often the fastest path to identifying the conflicting rules.


How to fix a 508 or redirect loop

Once the loop is identified the fix is straightforward, remove the circular reference from the redirect rules.

  • Audit all redirect rules together: redirect loops often occur because rules are configured in multiple places (.htaccess files, server config blocks, CDN settings, application-level redirects) without a complete picture of how they interact. Reviewing all redirect rules in one place makes conflicts easier to spot.

  • Check www and non-www rules carefully: ensure that only one canonical version of the domain is set and that redirect rules only ever point toward it, never away from it. A rule that redirects www to non-www should never coexist with a rule that redirects non-www to www.

  • Verify HTTP to HTTPS rules at every layer: if a CDN or reverse proxy is handling HTTPS termination and forwarding requests to an origin server over HTTP, ensure the origin server does not have its own HTTP to HTTPS redirect rule that would create a loop with the CDN layer.

  • Test in staging before deploying: redirect rule changes should always be tested in a staging environment before being applied to production. A loop in staging is an inconvenience. A loop in production is an outage.

  • Use a redirect management tool: managing redirects centrally through a dedicated tool rather than across multiple config files reduces the risk of conflicting rules creating loops. A single source of truth for redirect rules makes it far easier to spot and prevent circular references before they cause problems.


Common mistakes that cause redirect loops

  • Configuring www and non-www redirects at multiple layers: setting redirect rules at the server, CDN, and application level simultaneously without coordinating them is the most common cause of www-related redirect loops.

  • Wildcard rules that catch their own destinations: a catch-all redirect that redirects all traffic on a domain including the URL it is redirecting to creates an instant loop. Always ensure wildcard rules explicitly exclude their destination.

  • Copying redirect rules between environments: rules that work correctly in one environment can create loops in another if the infrastructure configuration differs, particularly around HTTPS termination and proxy setups.

  • Not testing after configuration changes: a redirect rule that looks correct in isolation can conflict with existing rules in ways that are not obvious without testing. Always verify the full redirect chain for affected URLs after any configuration change.

Related terms

Related terms

Ready to keep every link alive?

Ready to keep every link alive?

Ready to keep every link alive?