406 Status Code Explained: Why It Happens and How to Fix It

406 status code

A 406 status code can appear when you’re trying to load a webpage, but the server can’t provide content in the format your browser requested. Instead of the page you expected, you get an error message—usually vague and unhelpful—leaving you unsure of what went wrong.

Unlike common errors like 404 or 500, the 406 status code is more technical and less understood. It typically occurs when there’s a mismatch between what the client (like your browser or app) asks for and what the server can deliver—such as HTML, JSON, or XML.

If you’re managing a website that relies on user experience or local SEO rankings, this kind of error can negatively impact visibility and performance. In this guide, we’ll explain what the 406 status code means, why it happens, and how to fix it. Whether you run a business site, build apps, or simply browse the web, this article offers clear answers without the technical overload.

What Is a 406 Status Code?

The 406 status code, also known as “Not Acceptable,” is an HTTP response sent by a web server when it cannot return content that matches the criteria defined by the client’s request headers.

In simpler terms, it means the browser or client has asked for a specific format (like HTML, JSON, or XML), and the server doesn’t have any content in that format to deliver.

When and Why Does the 406 Error Occur?

Here are some common scenarios that trigger a 406 status code:

  • The client sends restrictive Accept headers (e.g., only wanting JSON, but the server only has HTML).
  • The server has limited content types available.
  • Misconfigured server settings that reject specific content types.
  • Browser extensions or proxies are modifying request headers unexpectedly.

Real-world example: If your browser only accepts images in PNG format, and the server can only send JPG, you may receive a 406 error.

Technical Breakdown: How the HTTP Request Plays a Role

When a browser makes a request to a website, it includes an Accept header that tells the server which content types it can handle. This might include:

  • text/html
  • application/json
  • image/webp
  • application/xml

If the server doesn’t have a matching format, it returns the 406 status code instead of a response.

Key Stats That Highlight the Problem

  • According to W3Techs, over 96% of websites serve content in HTML format.
  • But many APIs and mobile apps now prefer JSON or XML, increasing the chances of mismatch.
  • Less than 1% of total HTTP response errors are 406, but they can cause significant confusion for developers and site visitors.

Signs You’re Facing a 406 Status Code

  • You visit a page, and instead of loading content, you see a “406 Not Acceptable” message.
  • You’re working with an API and receive a failed response with code 406.
  • Your website suddenly fails to load correctly after a recent configuration change or update.

How to Fix a 406 Status Code

Here’s a practical checklist to resolve the error:

Check Request Headers: 

A common cause of the 406 status code is overly strict Accept headers in the client’s request. These headers tell the server what content types (like HTML, JSON, or XML) the client can accept.

If the request is too specific and the server doesn’t support that format, it returns a 406 error. To fix this, make sure your browser, API tool, or app sends flexible headers—like Accept: */*—especially during testing.

If you’re writing code or using a framework, review your header settings to ensure they aren’t unnecessarily limiting the response formats.

Configure the Server Properly:

If you’re a developer or managing a website, it’s important to make sure your server is set up to handle various content types. A server that only supports a limited format might reject requests with specific Accept headers, causing a 406 status code.

On Apache servers, you can adjust content negotiation settings through the .htaccess file. For NGINX, these settings are managed in the server block configuration. Make sure the server is not restricting content types and can respond appropriately to different client requests.

Also, double-check that no recent server updates or changes have accidentally blocked common content types like HTML or JSON.

Review Content Negotiation Logic:

If your website or application runs on a CMS or framework like WordPress, Laravel, or Django, the platform might have built-in content negotiation handled by middleware or plugins. This logic determines how the server responds to different content types requested by the client.

If the supported formats are too limited or not aligned with what the client is asking for, a 406 status code can occur. Check your middleware settings or route configuration and ensure that common formats like text/html, application/json, or application/xml are properly supported.

In some cases, expanding or adjusting the list of accepted response formats is all it takes to fix the issue.

Disable or Adjust Security Modules: 

Many web hosting providers use built-in security tools like ModSecurity to protect websites from malicious traffic. While helpful, these filters can sometimes be too strict and mistakenly block legitimate requests—leading to a 406 status code.

If you suspect this is the case, check your hosting control panel or contact your hosting provider to review ModSecurity logs. You can try temporarily disabling the module or tweaking its rules to prevent false positives without compromising security.

Keep in mind that if you’re not familiar with server-level security settings, it’s best to make changes with support guidance to avoid creating new vulnerabilities.

Try Different Browsers or Devices: 

Sometimes, the issue isn’t with the server at all—it’s on your end. Browser extensions, plugins, or specific settings can alter request headers without you realizing it, which may trigger a 406 status code.

To rule this out, try opening the same page in a different browser or in incognito/private mode. You can also test from another device entirely. If the error disappears, it’s likely a local issue caused by a plugin or browser configuration.

This quick check can save you time before diving into deeper server troubleshooting.

Developer Tip: Debugging 406 in APIs

When working with APIs:

  • Double-check your Accept header using tools like Postman.
  • Make sure the server supports the format you’re requesting (e.g., application/json).
  • Look for fallback handlers in your code that allow defaults if negotiation fails.

Preventing 406 Errors in the Future

To avoid future issues with the 406 status code, consider the following:

  • Use content fallback strategies in your server or app.
  • Avoid overly specific Accept headers unless necessary.
  • Regularly test your site’s response headers using tools like cURL or browser dev tools.
  • If using a content delivery network (CDN), ensure it isn’t altering or restricting content types.

Conclusion

The 406 status code isn’t the most common web error, but it can be a roadblock when it appears. Whether you’re a site owner, developer, or casual browser, understanding why this happens and how to fix it can save you time and hassle. Most of the time, it’s about mismatched expectations between the client and the server.

Now that you know what the 406 status code means, you can take action and get your site or app running smoothly again.

FAQs

What does “Not Acceptable” really mean in a 406 error?

It simply means the server couldn’t give you the content in the format your browser or app asked for. Think of it like asking for a vegetarian meal at a restaurant that only serves meat—it just can’t fulfill the request the way you want.

Can regular website visitors fix a 406 error on their own?

Sometimes, yes! Try refreshing the page, switching browsers, clearing your cache, or using incognito mode. If that doesn’t work, it’s likely something on the server side, and the website owner will need to fix it.

I’m using an API—why am I getting a 406 error suddenly?

You’re probably asking for a content type (like application/json) that the server isn’t set up to return. Double-check your Accept headers in your request and ensure the API supports that format.

Could my WordPress site suddenly start showing 406 errors?

Yes, especially after installing a new plugin, changing themes, or if your host updated server security settings (like ModSecurity). Check .htaccess and your security plugins for content filters.

How do I prevent 406 errors from coming back?

Keep your Accept headers broad and allow fallbacks in your code. Also, test your site on different browsers and devices regularly. If you’re running a server, make sure it can respond with multiple content formats.

Scroll to Top