---
title: "HTTP 508 Loop Detected: what it means and how to fix it"
url: https://proxy.wiki/glossary/http-status-508/
type: Glossary Term
author: "proxy.wiki editorial"
published: 2026-10-21
updated: 2026-10-21
site: proxy.wiki
topics: ["Web scraping"]
license: CC BY 4.0; quote freely with attribution to https://proxy.wiki/
---

# HTTP 508 Loop Detected: what it means and how to fix it

> HTTP 508 Loop Detected means a WebDAV operation or proxy route found a cycle. Inspect bindings and Via hops before retrying.

HTTP 508 means a WebDAV operation detected a loop: “Loop Detected”. RFC 5842 [section 7.2](https://www.rfc-editor.org/rfc/rfc5842#section-7.2) defines it for a request that cannot finish because processing would revisit a resource or binding. The classic case is a `BIND` or `UNBIND` graph that points back to itself. A proxy chain can also loop, but a normal forward proxy should refuse that loop with its own routing error rather than pretending the origin sent 508.

508 is not a generic “too many redirects” response. An HTTP client can follow redirects until it reaches a client-side limit without receiving 508. The status is a server-side declaration that the operation’s resource graph or routing path has a cycle.

## Reproduce a loop check locally

This Python 3.15.0 service counts a private `Via` marker and returns 508 after the marker appears three times. It models the observable response without claiming that every proxy uses the same threshold:

```
from http.server import BaseHTTPRequestHandler, HTTPServer

class H(BaseHTTPRequestHandler):
    def do_GET(self):
        via = self.headers.get("Via", "")
        if via.count("pw-edge") >= 3:
            body = b"loop: saw pw-edge 3 times\n"
            self.send_response(508)
        else:
            body = b"ok\n"
            self.send_response(200)
        self.send_header("Content-Length", str(len(body)))
        self.end_headers()
        self.wfile.write(body)

HTTPServer(("127.0.0.1", 47508), H).serve_forever()
```

```
$ curl -si -H 'Via: 1.1 pw-edge, 1.1 pw-edge, 1.1 pw-edge' http://127.0.0.1:47508/
HTTP/1.1 508 Loop Detected
Server: BaseHTTP Python/3.15.0
Content-Length: 26

loop: saw pw-edge 3 times
```

The capture used curl 8.7.1. With the loop check disabled in the local proxy, the request closed after about three seconds and curl reported error 52. Squid 6.13 in a deliberately looping configuration returned 403 with `ERR_ACCESS_DENIED`, showing that a proxy’s loop protection can use a different code. Match the number and the signer, not the word “loop” in an arbitrary page.

## WebDAV bindings and proxy chains

In WebDAV, the operation can traverse a collection and its bindings. A binding that points back to an ancestor makes a depth request non-terminating, so the server returns 508 instead of walking forever. The response may include a DAV error body that identifies the binding. Read that body before deleting resources, because the loop may be a legitimate link that only the requested depth exposes.

In a proxy chain, inspect each [Via](/glossary/via-header/) value and the connection route. Two proxies configured to forward to each other can bounce a request until a hop limit or loop detector stops it. A new exit address does not repair a cycle in the proxy configuration. If the target returns 508 only when a particular forward proxy is used, test the target direct and then one hop at a time.

Do not “fix” a 508 by increasing the hop limit. A loop that runs longer consumes connections and can amplify traffic. Identify the repeated host, binding or Via marker and remove the cycle.

## Causes and fixes

| Cause | Evidence | What to change |
| --- | --- | --- |
| WebDAV binding points to an ancestor | Depth request returns 508 and DAV error data names a binding | Remove or correct the binding, or use a finite depth for the operation |
| Two proxy hops forward to each other | Via repeats the same proxy names or the access logs alternate between two listeners | Break the route cycle and set an explicit upstream for each hop |
| Reverse proxy route points back to itself | One upstream request creates another request to the same virtual host | Use the origin address or a separate internal name, not the public route |
| Client follows a redirect loop | No 508; client reports a redirect limit and the Location values repeat | Fix the redirect target or cap redirects and report the cycle separately |
| Proxy loop protection uses another status | Squid or a gateway returns 403 or 502 with a loop diagnostic | Read the proxy logs and repair the chain instead of searching for an origin 508 |

For status-code classification, see [502 Bad Gateway](/guides/502-vs-504/) and [504 Gateway Timeout](/glossary/http-status-504/). The [curl proxy guide](/guides/how-to-use-a-proxy-with-curl/) shows how to inspect a chain. For request routing, the [forward proxy](/glossary/forward-proxy/) entry explains how each hop should identify itself. Keep loop detections in a separate metric from ordinary 4xx responses.

## Frequently asked questions

### Is 508 only for WebDAV?

RFC 5842 defines it for WebDAV bindings. Other systems may reuse the code for a detected routing loop.

### Is 508 the same as a redirect loop?

No. A redirect loop is usually stopped by the client. 508 is a server response that declares a loop.

## Sources

1. [RFC 5842 section 7.2: 508 Loop Detected](https://www.rfc-editor.org/rfc/rfc5842#section-7.2)
2. [IANA HTTP Status Code Registry](https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml)
