506 Variant Also Negotiates
The server has an internal configuration error in content negotiation.
Usually happens because:
- ☑ Circular configuration references where variant
🔍 Quick Checklist:
Meaning
The HTTP 506 Variant Also Negotiates server error status code indicates that the server has an internal configuration error: the chosen variant resource is configured to engage in transparent content negotiation itself, and is therefore not a proper negotiation endpoint.
Root Causes
- Circular configuration references where variant resources refer to content negotiation loops.
| Cause | Frequency |
|---|---|
| Circular configuration references where variant | ⭐⭐⭐⭐⭐ |
Common Mistakes
- Configuring content negotiation indices to reference other index files recursively.
How to Fix
Framework-Specific Examples
Express router returning 506.
app.get('/negotiate', (req, res) => {
res.status(506).send('Content negotiation loop detected.');
});Server Configuration Examples
Nginx ignores status 506.
# Handled by upstream applicationPrevention
- Map all content variations (e.g. languages) to explicit, terminal resource paths.
Frequently Asked Questions (FAQ)
Q: What is transparent content negotiation?
It is an HTTP protocol extension (RFC 2295) that allows a server to delegate the selection of format representations to the client, supplying index parameters.
Q: Why does a 506 error occur?
It occurs when a server tries to negotiate a resource format (like language or type), but the chosen variation is configured to negotiate again, creating an infinite loop.
Q: Is 506 cacheable?
No. 506 Variant Also Negotiates responses are never cached.
Q: Is 506 widely used?
No. Transparent content negotiation is rarely implemented in modern web APIs; most web apps use custom routing parameters instead.