508 Loop Detected
The server terminated the operation because it encountered an infinite loop while processing it.
Status
HTTP/1.1 508 Loop Detected
Details
- Category: 5xx
- Status: Standard. Registered with IANA and defined by a current standards-track RFC.
- Specification: RFC 5842 §7.2
- Cacheable: Not cacheable
- Response body: Allowed
- Retry: Do not retry
508 comes from the WebDAV bindings extension. Bindings let a resource appear at several paths, which makes it possible to build a cycle: a collection that eventually contains itself. A deep operation across such a graph would never terminate, so the server stops and reports 508.
It is also used more loosely for other detected infinite loops, such as a recursive include or a redirect cycle caught by the application rather than by the client.
Common causes
- A cycle in WebDAV bindings encountered by a Depth: infinity request.
- Recursive symlinks or mount points inside a served directory tree.
- An application-level recursion the server detected and aborted.
How to fix it
As the client
- Use a bounded depth instead of Depth: infinity.
- Do not retry. The cycle is structural and will be hit again.
As the server
- Break the cycle in the resource graph, and use 208 to report resources already enumerated.
- Add depth limits to recursive operations so a cycle costs one bounded traversal rather than an outage.
Examples
PROPFIND /dav/collections/ HTTP/1.1 Host: files.example.com Depth: infinity HTTP/1.1 508 Loop Detected