An HTTP 508 Loop Detected response indicates that the server terminated an operation because it encountered an infinite loop while processing a request with Depth: infinity or recursive internal redirects.

HTTP 508 at a glance

  • Status: 508
  • Phrase: Loop Detected
  • Class: 5xx Server Error
  • Specification: RFC 5842 Section 7.2
  • Origin: WebDAV binding extension / internal redirect engine
  • Client retry: Unsafe without correcting the circular resource binding or rewrite rule

What a 508 response tells you

When a server returns an HTTP 508 status code, specific protocol facts are established:

  1. An infinite loop was encountered: The server actively aborted execution after detecting that request processing entered a circular loop.
  2. The operation was terminated safely: Rather than consuming infinite CPU, memory, or stack frames, the server stopped processing and informed the client.

What a 508 does not tell you

  • It is not caused by client-side browser redirect loops (which trigger browser ERR_TOO_MANY_REDIRECTS).
  • It does not mean the server hardware failed.

Similar status codes

500 Internal Server Error

A generic server crash.

502 Bad Gateway

A proxy received an invalid upstream response.

For more details, see our guide on HTTP 500 Internal Server Error.

Diagnostic scenarios

A shared directory contains a symbolic link named backup pointing to its parent folder. When a client performs a PROPFIND with Depth: infinity, the server detects the cyclic loop and returns 508.

Scenario 2: Internal proxy rewrite loop

A reverse proxy rewrites /app/ to /app/index.php, which triggers another rule rewriting back to /app/. After hitting the internal recursion limit, the proxy returns 508.

Common causes of HTTP 508

A WebDAV request with Depth: infinity traversed a directory containing a circular symlink that points back to a parent folder, creating an infinite traversal loop.

Recursive internal server URL rewrite rules

A misconfigured NGINX or Apache rewrite rule redirected an internal path in a continuous cycle without hitting a terminating condition.

Cyclic microservice call chains or service mesh routing loops

Service A called Service B, which called Service C, which routed back to Service A without decrementing a hop limit or detecting recursion.

Headers you may encounter

  • Content-Type: Problem Details (application/problem+json).
  • Date: Response generation timestamp.

Troubleshooting flow

HTTP 508 Loop Detected
  |
  +-- Is this a WebDAV request (Depth: infinity)?
        |
        +-- Yes: Check collection symlinks and folder bindings.
        |
        +-- No: Inspect reverse proxy URL rewrite rules and service mesh routing.

What to check before changing backend code

  1. Check for circular symlinks on the server storage volume.
  2. Review web server URL rewrite directives for proper break/last flags.
  3. Inspect distributed tracing spans for circular service calls.

How to verify the fix

Test the collection or endpoint with curl using a bounded depth or standard GET:

curl -i -X PROPFIND https://api.example.test/webdav/documents/ \
  -H "Authorization: Bearer test-token" \
  -H "Depth: 1"

Ensure the server returns 207 Multi-Status or 200 OK without encountering circular loops.

Remediation paths to evaluate

Remove cyclic symlinks or configure the WebDAV server to ignore symlinks during recursive traversals.

If URL rewrite loops exist

Add terminating conditions and ensure NGINX rewrite directives use break or last appropriately.

FAQ

Is 508 the same as ERR_TOO_MANY_REDIRECTS?

No. ERR_TOO_MANY_REDIRECTS is a client-side browser error for HTTP 301/302 redirect loops. Status 508 is returned by the server for server-side processing loops.

Key takeaway

HTTP 508 Loop Detected indicates that the server aborted an operation upon encountering an infinite loop during recursive collection traversal or internal rewrites. Eliminate circular symlinks and verify terminating conditions in rewrite rules.