506 Variant Also Negotiates: A Circular Content Negotiation
.htaccess, mod_negotiation, or other content negotiation directives that create infinite loops.
What Is Transparent Content Negotiation?
Transparent content negotiation is a mechanism where the server selects the best representation of a resource based on client headers (e.g., Accept-Language, Accept-Encoding). The server can offer multiple variants (e.g., different languages, formats) and chooses the most appropriate one. If the negotiation rules create a loop (variant A points to variant B, which points back to variant A), the server cannot decide and returns 506.
Common Causes of 506 Errors
| Cause | Example | How to Fix |
|---|---|---|
| Circular variant references | Variant A says "choose variant B" and variant B says "choose variant A". | Break the loop by explicitly defining the variants without mutual references. |
| Misconfigured .htaccess | Apache Multiviews or RewriteRule that redirects to itself. | Check rewrite rules and negotiation settings; ensure they don't create loops. |
| Content negotiation module errors | mod_negotiation misconfiguration. | Simplify negotiation rules or disable transparent negotiation if not needed. |
| Proxy or CDN interference | A proxy adds headers that trigger a loop. | Check proxy settings; ensure they don't modify negotiation headers. |
Example: 506 Response
How to Fix 506 Errors
- Check Apache configuration: If you're using Apache's
MultiviewsorRewriteRule, look for loops. Simplify the negotiation rules. - Disable transparent negotiation: If you don't need it, turn it off. In Apache, you can remove
Options +MultiViewsor setMultiviewsMatch Anycarefully. - Use explicit redirects: Instead of relying on negotiation, use explicit 301/302 redirects to the correct variant.
- Check for proxy loops: If you have a reverse proxy, ensure it doesn't add headers that cause the server to renegotiate infinitely.
Preventing 506 Errors
- Test negotiation rules thoroughly – simulate requests with different headers to ensure no loops.
- Monitor logs – watch for negotiation errors in server logs.
- Simplify configuration – avoid complex negotiation hierarchies.
Frequently Asked Questions
Is 506 a client error or a server error?
It's a server error (5xx) because the server's configuration is faulty. The client's request is valid, but the server cannot process it due to its own misconfiguration.
Can I see 506 in the wild?
Very rarely. It mostly occurs in poorly configured Apache servers with mod_negotiation enabled. Most modern sites avoid transparent negotiation in favor of explicit redirects or server-side language detection.
What is the difference between 506 and 500?
506 is a specific error for negotiation loops. 500 is a generic catch-all for any other internal error.