506 Variant Also Negotiates
Usage
The 506 Variant Also Negotiates status code occurs during Transparent Content Negotiation, where the protocol selects the best variant of the target resource for the client when multiple variants are available.
Variants are different versions of the subject resource. For example, a resource available in several languages has a variant for each one. Transparent Content Negotiation automatically selects the best variant when a GET or HEAD request is made.
The 506 error means the selected variant is itself configured to negotiate, resulting in a loop the server terminates.
Example
A client sends a GET request with an Accept header. The server attempts content negotiation but discovers the chosen variant also references negotiation, resulting in a circular configuration error.
Request
GET /docs HTTP/1.1
Host: example.com
Accept: text/html, application/xhtml+xml
Response
HTTP/1.1 506 Variant Also Negotiates
Content-Type: text/html; charset=UTF-8
Content-Length: 191
<html>
<head>
<title>Variant Also Negotiates</title>
</head>
<body>
<p>Content negotiation for the requested
resource resulted in a circular reference.</p>
</body>
</html>
How to fix
The server’s content negotiation setup has a circular reference: a selected variant is itself configured to negotiate further. Break the loop by ensuring every variant points to a concrete representation.
Apache-specific fixes:
General fixes:
This status code is experimental and rarely seen in production. Most modern applications handle content negotiation at the application layer, avoiding the server-level transparent negotiation mechanism entirely.
Code references
.NET
HttpStatusCode.VariantAlsoNegotiates
Rust
http::StatusCode::VARIANT_ALSO_NEGOTIATES
Rails
:variant_also_negotiates
Go
http.StatusVariantAlsoNegotiates
Symfony
Response::HTTP_VARIANT_ALSO_NEGOTIATES_EXPERIMENTAL
Python3.5+
http.HTTPStatus.VARIANT_ALSO_NEGOTIATES
Apache HttpComponents Core
org.apache.hc.core5.http.HttpStatus.SC_VARIANT_ALSO_NEGOTIATES
Angular
@angular/common/http/HttpStatusCode.VariantAlsoNegotiates