HTTP 508 Loop Detected

Loop Detected

HTTP 508 is Loop Detected: the server ended an operation because it hit an infinite loop while processing a request with Depth: infinity, and the whole operation failed (RFC 5842 section 7.2). RFC 5842 is WebDAV’s binding extension, which lets one resource appear at several URLs, and so lets a collection end up inside itself.

How a loop happens

/projects/            a collection
/projects/myself/     a binding back to /projects/ itself

A PROPFIND with Depth: infinity on /projects/ would walk /projects/myself/myself/myself/... forever. RFC 5842 gives the server two ways out. For a client that sends the DAV: bind request header, saying it understands bindings, the server lists each collection once inside a 207 Multi-Status and marks the repeats 208 Already Reported. For any other client, it rejects the request with 508:

PROPFIND /projects/ HTTP/1.1
Depth: infinity
Content-Type: application/xml; charset="utf-8"

<?xml version="1.0" encoding="utf-8"?>
<D:propfind xmlns:D="DAV:"><D:prop><D:displayname/></D:prop></D:propfind>

HTTP/1.1 508 Loop Detected

The server can also send the 508 as one entry inside a multistatus it was already streaming when it found the loop. Servers may refuse to create bind loops in the first place; RFC 5842’s DAV:cycle-allowed precondition covers that.

The 508 you probably saw

On shared hosting, 508 Resource Limit Is Reached has nothing to do with WebDAV. It comes from CloudLinux’s per-account limits, common on cPanel and Plesk hosts: the account has hit its cap on entry processes, the dynamic requests it may run at the same moment, and new ones are refused until some finish. Look for what’s holding them, such as slow PHP pages, an aggressive crawler or a pile-up of cron jobs, or ask the host for a higher limit.

Not for redirect loops

A server can’t see a redirect loop: each hop is a separate request, and it’s the client that gives up, as in Chrome’s ERR_TOO_MANY_REDIRECTS or curl stopping after 50 redirects with -L. Fix the redirect rules; there’s no status code for it.

Gotchas

  • Use Depth: 1 and walk the tree yourself. RFC 4918 lets a server refuse Depth: infinity with a 403 and the propfind-finite-depth precondition, and Apache’s mod_dav does unless DavDepthInfinity is on.
  • Your own recursion. 508 can fit an API whose request describes a cycle it was asked to expand, but a loop in your own code is a bug, and a 500.
  • Caching. 508 isn’t heuristically cacheable.

Search 207 208 508 in the tool below to see the WebDAV codes together.

Try it in the HTTP Status Codes

508 Loop Detected

  1. 508Loop Detected5xx Server error

    The server stopped while working on the request because it found an endless loop, such as a collection that contains itself.

    When to use it

    Deep WebDAV operations over a tree with a cycle in it.

    Common mistakes

    Using it for redirect loops, which are the client’s problem, and for recursion your own code should have bounded.

    Not cacheable by defaultRFC 5842

Every code, by class

Codes marked unofficial come from one server’s own convention — nginx, Cloudflare, cPanel, Microsoft — and are not in the IANA registry.

Runs in your browser. Nothing you enter is sent anywhere.