508 Loop Detected
Usage specific to WebDAV
The 508 Loop Detected status code occurs when the client submits a WebDAV request for an entire directory and the result creates a target within the same tree. This produces an infinite request/response loop with Depth: Infinity, and the server terminates the entire operation.
Usage specific to cPanel / CloudLinux
The 508 Resource Limit Is Reached status code is generated by shared hosting environments running cPanel with CloudLinux when one of the account’s resource limits has been exceeded. Examples of resource limits include CPU usage, physical memory, I/O throughput, and the number of concurrent processes (entry processes).
Example
A WebDAV client requests a recursive directory listing. The server detects a binding loop within the collection hierarchy and terminates the request.
Request
PROPFIND /shared/ HTTP/1.1
Host: example.com
Depth: infinity
Content-Type: application/xml
Response
HTTP/1.1 508 Loop Detected
Content-Type: text/html; charset=UTF-8
Content-Length: 174
<html>
<head>
<title>Loop Detected</title>
</head>
<body>
<p>The server detected an infinite loop
while processing the directory tree.</p>
</body>
</html>
How to fix
For WebDAV (508 Loop Detected):
A PROPFIND with Depth: infinity hit a circular binding, where a collection contains a reference back to a parent or to itself.
For cPanel / CloudLinux (508 Resource Limit Is Reached):
The hosting account exceeded a resource limit: CPU, memory, I/O, or entry process count.
Code references
.NET
HttpStatusCode.LoopDetected
Rust
http::StatusCode::LOOP_DETECTED
Rails
:loop_detected
Go
http.StatusLoopDetected
Symfony
Response::HTTP_LOOP_DETECTED
Python3.5+
http.HTTPStatus.LOOP_DETECTED
Apache HttpComponents Core
org.apache.hc.core5.http.HttpStatus.SC_LOOP_DETECTED
Angular
@angular/common/http/HttpStatusCode.LoopDetected