Skip to content

506 Variant Also Negotiates

Description

The 506 Variant Also Negotiates status code indicates that the server has an internal configuration error where the chosen variant resource is configured to engage in transparent content negotiation itself, and is therefore not a proper endpoint in the negotiation process.

This status code is related to content negotiation, a mechanism defined in HTTP that allows a client and server to determine the most appropriate representation (variant) of a resource to transfer. The error occurs when the server's configuration creates a circular reference in the content negotiation process.

This is a relatively rare status code and is specific to servers implementing transparent content negotiation as defined in RFC 2295. It indicates a server misconfiguration rather than a client error.

Syntax

HTTP/1.1 506 Variant Also Negotiates
Content-Type: application/json
Content-Length: 217

{
  "error": {
    "code": 506,
    "message": "Variant Also Negotiates",
    "details": "The server has an internal configuration error: the chosen variant resource is configured to engage in content negotiation itself."
  }
}

Examples

Example 1: Circular Content Negotiation

A server is configured to serve different variants of a document based on the Accept-Language header, but the variant itself is configured to perform content negotiation.

Request:

GET /documents/report.html HTTP/1.1
Host: example.com
Accept-Language: fr

Response:

HTTP/1.1 506 Variant Also Negotiates
Content-Type: application/json
Content-Length: 249

{
  "error": {
    "code": 506,
    "message": "Variant Also Negotiates",
    "details": "The French variant of this document is configured to perform content negotiation itself, creating a circular reference in the negotiation process."
  }
}

Example 2: Proxy Server Configuration Error

A proxy server encounters a circular reference in content negotiation when trying to determine the appropriate variant to serve.

Request:

GET /api/data HTTP/1.1
Host: example.com
Accept: application/json, application/xml;q=0.9

Response:

HTTP/1.1 506 Variant Also Negotiates
Content-Type: application/json
Content-Length: 265

{
  "error": {
    "code": 506,
    "message": "Variant Also Negotiates",
    "details": "The proxy server has detected a circular reference in content negotiation. The selected variant for application/json is itself configured to perform content negotiation."
  }
}

Example 3: Content Delivery Network Configuration Error

A CDN encounters a configuration error when trying to serve the appropriate variant of a resource based on client capabilities.

Request:

GET /images/photo.jpg HTTP/1.1
Host: cdn.example.com
Accept: image/webp,image/jpeg;q=0.8

Response:

HTTP/1.1 506 Variant Also Negotiates
Content-Type: application/json
Content-Length: 237

{
  "error": {
    "code": 506,
    "message": "Variant Also Negotiates",
    "details": "The CDN has detected a configuration error. The WebP variant of this image is itself configured to perform content negotiation."
  }
}

Summary

The 506 Variant Also Negotiates status code indicates a server configuration error related to content negotiation. It occurs when the server has selected a variant resource that is itself configured to engage in content negotiation, creating a circular reference.

Key points about 506 Variant Also Negotiates:

  1. It indicates a server misconfiguration, not a client error
  2. It's specific to servers implementing transparent content negotiation (RFC 2295)
  3. It's a relatively rare status code in practice
  4. The error creates a circular reference in the content negotiation process
  5. It can only be fixed by reconfiguring the server
  6. Clients cannot resolve this issue by modifying their requests
  7. It's different from 406 Not Acceptable, which indicates that no acceptable variant was found during content negotiation
  8. System administrators should check their content negotiation configuration when encountering this error