Skip to content

HTTP Status Code 506 – Variant Also Negotiates

HTTP Status Code 506 – Variant Also Negotiates

Description

The HTTP status code 506 Variant Also Negotiates is a server error response. It indicates that the server has an internal configuration error: the chosen variant resource is configured to engage in content negotiation itself, which is not appropriate as it leads to an infinite loop. This status code is part of the Transparent Content Negotiation protocol, which allows clients to negotiate the best representation of a resource available from a server.

Examples

Example 1: Misconfigured Content Negotiation

GET /example-resource HTTP/1.1
Host: www.example.com
Accept: text/html, application/xhtml+xml

In this scenario, the server at www.example.com is expected to negotiate the best content format for the client based on the Accept header. If the chosen variant of /example-resource is also configured to negotiate content, the server might return a 506 Variant Also Negotiates error due to a misconfiguration causing a negotiation loop.

Example 2: Server Configuration Error

GET /documents HTTP/1.1
Host: www.documents.example
Accept: application/pdf, application/json

Here, the client requests the best available format for /documents from the server www.documents.example. If the server is incorrectly set up so that the selected variant (e.g., a PDF document) is also trying to negotiate its representation, a 506 Variant Also Negotiates status code may be returned, indicating the need for a server configuration review to resolve the negotiation loop.

Example 3 Scenario

# Client sends a request example.
GET /example HTTP/1.1
Host: www.example.com

# Server Response
HTTP/1.1 506 506 Variant Also Negotiates
Date: Wed, 09 Oct 2024 23:11:24 GMT
Server: ExampleServer/1.0
Content-Type: application/json

{
    "error": "Description of the error for 506"
}

Example 4: Another Scenario

# Client sends another example request.
POST /another-example HTTP/1.1
Host: www.example.com

# Server Response
HTTP/1.1 506 506 Variant Also Negotiates
Date: Wed, 09 Oct 2024 23:11:24 GMT
Server: ExampleServer/1.0
Content-Type: application/json

{
    "error": "Detailed message for 506"
}

Summary

The 506 Variant Also Negotiates status code is a rare HTTP response indicating a server misconfiguration involving content negotiation loops. It highlights the importance of proper server configuration in scenarios where content negotiation is used. Typically, resolving this error involves ensuring that chosen variants of resources do not attempt to negotiate content themselves.

I am the founder of SEO Leaders and have been involved in the internet and web development in one way or another for over 20 years. Since founding SEO Leaders some 6 years ago I have been heavily involved in web develepment, Digital PR and technical SEO for a wide variety of projects. I hope to enlighten you on a wide range of topics related to my chosen profession!

Back To Top