An HTTP error 406 (Not Acceptable) means the server understood the request but can’t return a response in a format the client asked for. This usually happens because of the Accept headers. If your request says it only accepts application/json, but the server only sends HTML, you’ll hit a 406.
I see this a lot with APIs. A strict Accept header is often the culprit. Some HTTP clients automatically send headers that don’t match what the API supports. Removing or loosening the Accept header usually fixes the HTTP error 406 instantly.
From the frontend side, browsers can trigger this too. Certain security plugins or proxies modify headers like Accept-Language or Accept-Encoding. The server then rejects the request and throws an HTTP error 406. Testing in incognito mode or another browser helps isolate this.
Reverse proxies like Nginx, Apache, or Cloudflare can also cause HTTP error 406. I once had a WAF rule blocking requests because of “unacceptable content negotiation.” Checking proxy logs is critical—sometimes the backend app never even sees the request.
If you’re building the API yourself, the fix is usually to make content negotiation more flexible. Instead of strictly matching headers, return a default response format (like JSON) when the Accept header isn’t supported. This prevents unnecessary HTTP 406 errors.
In some setups, HTTP error 406 is intentionally used as a security measure. Servers may block requests with suspicious headers or user agents. If you’re scraping or using automation tools, try setting a standard browser User-Agent and reasonable Accept headers.
Quick tip: use Postman or curl to reproduce the issue. When you manually change the Accept header, you’ll usually see exactly which value triggers the 406. That’s often faster than debugging code blindly.
Frameworks like Spring, Django, or ASP.NET can auto-enforce content negotiation rules. I’ve seen HTTP error 406 appear after a framework update because defaults changed. Double-check controller annotations or response serializers after upgrades.
In short, an HTTP Error 406 usually means “I can’t respond in the format you asked for.”
It’s rarely a server crash more often a header mismatch. Fixing headers, proxy rules, or response formats almost always resolves it.