HTTPError.net

The fastest way to diagnose, understand, and fix any HTTP status code

508 Loop Detected

Fault: Server
TL;DR

A WebDAV status: the server terminated an operation because it encountered a self-referential infinite loop.

The server detected an infinite loop while processing the request.

What HTTP 508 Loop Detected Means

The server detected an infinite loop while processing the request.

A WebDAV status: the server terminated an operation because it encountered a self-referential infinite loop.

Common Causes

How to Fix It (For Visitors)

How to Fix It (For Developers/Admins)

Returning a 508 Loop Detected (Code Examples)

If you build APIs or web apps, here is how to send an HTTP 508 response and how to test for it:

Node.js (Express)

app.get('/resource', (req, res) => {
  res.status(508).json({ error: 'Loop Detected' });
});

Python (Flask)

@app.route('/resource')
def resource():
    return jsonify(error='Loop Detected'), 508

PHP

<?php
http_response_code(508);
header('Content-Type: application/json');
echo json_encode(['error' => 'Loop Detected']);

Check the status with curl

curl -I https://example.com/resource
# Look for: HTTP/1.1 508 Loop Detected

Frequently Asked Questions

What does HTTP 508 Loop Detected mean?

A WebDAV status: the server terminated an operation because it encountered a self-referential infinite loop. In short: The server detected an infinite loop while processing the request.

Is a 508 Loop Detected error my fault or the website's?

508 is a 5xx server-error code, so the problem is on the server side, not your browser or device. As a visitor you can usually only retry; if you run the site, investigate the server.

How do I fix a 508 Loop Detected error?

Break the circular reference. Add loop detection / depth limits. Audit bindings and includes for cycles.

Official Specification

The 508 Loop Detected status code is defined in RFC 5842 Section 7.2.

View the IANA HTTP Status Code Registry →