← Back to Chapters

Status Code 506 - Variant Also Negotiates

? HTTP Status Code 506

? Quick Overview

HTTP 506 – Variant Also Negotiates is a server-side error indicating a misconfiguration during content negotiation. It occurs when the server enters an infinite negotiation loop while selecting the best response variant for the client.

? Key Concepts

  • Part of the 5xx Server Error class
  • Related to content negotiation
  • Triggered by incorrect server configuration
  • Defined in RFC 2295

? Syntax / Theory

Content negotiation allows a server to serve different versions of the same resource based on headers such as Accept, Accept-Language, or Accept-Encoding.

A 506 error happens when:

  • A variant resource points back to itself
  • Negotiation rules create a circular dependency
  • The server cannot resolve a single best variant

? Code Example(s)

? View Code Example
// Apache misconfigured content negotiation example
AddType text/html .html
AddLanguage en .en
AddLanguage fr .fr

// Circular negotiation can trigger HTTP 506

? Live Output / Explanation

Server Response

The browser receives:

Status: 506 Variant Also Negotiates

This means the server failed internally and could not decide which version of the resource to serve.

? Interactive Loop Simulator

See how the server gets trapped in a decision loop. Click "Start Request" below to trace the negotiation path.

Variant A
(English)
"Check B"
Variant B
(French)
"Check A"
> Server ready. Waiting for request...

? Interactive Explanation

Think of content negotiation like a decision tree. When the tree loops back to itself, the server gets stuck and throws a 506 error instead of guessing.

? Use Cases

  • Debugging multilingual website configurations
  • Fixing server-side content negotiation rules
  • Learning advanced HTTP status codes
  • Understanding Apache and Nginx behavior

? Tips & Best Practices

  • Avoid circular references in variant definitions
  • Test content negotiation rules carefully
  • Use explicit default language or format
  • Check server logs for negotiation loops

? Try It Yourself

  • Configure language-based content negotiation locally
  • Intentionally create a loop and observe server behavior
  • Fix the configuration to remove the 506 error
  • Compare with other 5xx status codes