Error Codes Wiki

HTTP Content Negotiation — 406 Not Acceptable and Accept Header Errors

Warning4xx client error

About HTTP Content Negotiation

Fix HTTP 406 Not Acceptable errors caused by content negotiation failures when the server cannot produce a response matching the client's Accept headers. This guide covers everything you need to know about this topic, including common causes, step-by-step solutions, and answers to frequently asked questions.

Here are the key things to understand: Content negotiation allows clients to request specific formats via Accept, Accept-Language, Accept-Encoding headers. HTTP 406 Not Acceptable means the server cannot produce a response matching any of the client's acceptable formats. Server-driven negotiation uses client headers; agent-driven negotiation uses 300 Multiple Choices. The Accept header specifies media types: application/json, text/html, image/webp, etc.. Quality values (q=0.9) let clients express preference ordering. Understanding these fundamentals will help you diagnose and resolve this issue more effectively.

The most common reasons this occurs include: Client requesting a format the server does not support (e.g., Accept: application/xml on a JSON-only API). Overly restrictive Accept header excluding the server's available formats. API versioning via Accept header with an unsupported version string. Misconfigured reverse proxy stripping or modifying Accept headers. Identifying the root cause is the first step toward finding the right solution.

To resolve this, follow these recommended steps: Check which formats the API supports in its documentation. Set Accept: */* to accept any format, or Accept: application/json, text/html for common web formats. If using API versioning via Accept header, verify the version string matches supported versions. Test the request with curl adding -H 'Accept: application/json' to isolate the issue. Check proxy and CDN configuration to ensure Accept headers are forwarded correctly. If these steps do not resolve the issue, consider consulting additional resources or a qualified professional.

This article is part of our HTTP Status Codes collection on Error Codes Wiki. We provide comprehensive, up-to-date information to help you find solutions quickly.

Quick Answer

What does Accept: */* mean?

It means the client accepts any media type. This is the most permissive Accept value and should never trigger a 406 response.

Overview

Fix HTTP 406 Not Acceptable errors caused by content negotiation failures when the server cannot produce a response matching the client's Accept headers.

Key Details

  • Content negotiation allows clients to request specific formats via Accept, Accept-Language, Accept-Encoding headers
  • HTTP 406 Not Acceptable means the server cannot produce a response matching any of the client's acceptable formats
  • Server-driven negotiation uses client headers; agent-driven negotiation uses 300 Multiple Choices
  • The Accept header specifies media types: application/json, text/html, image/webp, etc.
  • Quality values (q=0.9) let clients express preference ordering

Common Causes

  • Client requesting a format the server does not support (e.g., Accept: application/xml on a JSON-only API)
  • Overly restrictive Accept header excluding the server's available formats
  • API versioning via Accept header with an unsupported version string
  • Misconfigured reverse proxy stripping or modifying Accept headers

Steps

  1. 1Check which formats the API supports in its documentation
  2. 2Set Accept: */* to accept any format, or Accept: application/json, text/html for common web formats
  3. 3If using API versioning via Accept header, verify the version string matches supported versions
  4. 4Test the request with curl adding -H 'Accept: application/json' to isolate the issue
  5. 5Check proxy and CDN configuration to ensure Accept headers are forwarded correctly

Tags

content-negotiation406accept-headermedia-typenot-acceptable

Related Items

More in 4xx Client Error

Frequently Asked Questions

It means the client accepts any media type. This is the most permissive Accept value and should never trigger a 406 response.