HTTPQUERY
English

508 Loop Detected

WebDAV 特定用法

508 Loop Detected 状态码出现在客户端针对整个目录提交 WebDAV 请求,而结果在同一目录树内产生了一个目标时。这会在 Depth: Infinity 下形成无限的请求/响应循环,服务器随即终止整个操作。

cPanel / CloudLinux 特定用法

508 Resource Limit Is Reached 状态码由运行 cPanel 与 CloudLinux 的共享托管环境生成,出现在账户的某项资源限制被超过时。资源限制的例子包括 CPU 占用、物理内存、I/O 吞吐量以及并发进程数(entry processes)。

SEO 影响

搜索引擎对 508 的处理与其他 5xx 服务器错误相同。持续的失败会降低抓取速率,并最终将受影响的 URL 从索引中移除。

示例

某个 WebDAV 客户端请求递归的目录列表。服务器在集合层级结构中检测到绑定循环并终止请求。

请求

PROPFIND /shared/ HTTP/1.1
Host: example.com
Depth: infinity
Content-Type: application/xml

响应

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>

如何修复

对于 WebDAV(508 Loop Detected):

带 Depth: infinity 的 PROPFIND 命中了循环绑定,即某个集合包含了一个指回父级或指回自身的引用。

对于 cPanel / CloudLinux(508 Resource Limit Is Reached):

托管账户超出了某项资源限制:CPU、内存、I/O 或 entry process 数量。

代码参考

.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