How to Fix HTTP 406 Not Acceptable Error? Client & Server Side Fix



What is HTTP 406 Error?

The 406 Error code is a client-side error that indicates the client’s request is not acceptable to the server. It triggers when the server cannot able to generate a response that matches the list of acceptable values specified in the request headers.

Therefore, this particular 406 Not acceptable error also contrasts with 5xx server errors such as 504 Gateway timeout.

It is one of the most uncommon HTTP errors that you hardly encounter while surfing the internet, but if you are unfortunate enough and had to see this error on your website, it is what generally looks like:

406 Not Acceptable Error
406 Not Acceptable Error

In the above image, you can see that Error 406 is acknowledged with an additional error message stating ” An appropriate representation of the requested resource could not be found on this server. This error was generated by Mod_Security.

Which is not that helpful for humans especially those who are not techie and it even sounds quite cryptic and robotic. So, let us make things easier for you to understand what exactly this error message trying to say.

The Client, i,e browser or the device is trying to say that they tried to show the webpage but there some possible issues that been occurred such as:

1. The server has sent the wrong file which is not supported by the browser.

2. The server is unable to produce valid security requirements or possibly doesn’t follow protocols.

Understanding the HTTP error 406

Let’s begin with very easy language, this error 506 simply shows that the server is not able to send the appropriate data in the format that is requested by the client, i.e. Web browser.

The client, i.e. your web browser has specific criteria or formats it can accept using the “Accept” header. But if the server is not able to fulfill these criteria it will respond with an HTTP status code error 406.

Now here comes the most challenging part, figuring out the exact cause of this error can be very problematic, it is because the issue can happen from anywhere in the server and the client communication chain.
But whatever the causes are, here are some of the methods you can try to fix this HTTP 406 error.


How do I fix error 406?

Here are some of the troubleshooting methods you can follow to fix error 406.

Client-side Solutions

1. Check whether the entered URL is correct or not

It sounds obvious and very basic, but trust us, it is the simplest but quickest method you can try to fix error 406.

Although, in reality, the error 406 is likely more than what it seems like, at this moment if you have entered the wrong URL and it is not valid you might encounter an error message “406 Not acceptable”.

To fix this issue, all you need to do is simply recheck the entered URL and verify everything is correct or not. Such as,

  • Check for any spelling mistakes
  • Check for if any special character is entered which is invalid
  • Try entering the URL of its other pages to check if it’s happening to the one page only.

If the error persists, check out our other solutions.

2. Reset and Configure your Network and Devices

Since error 406 is a client-side issue, certain platforms like online gaming or media streaming services, such as Netflix and music streaming platform Spotify, may also be unable to satisfy the client’s request, leading to the display of this error.

At this moment, you might be thinking it’s a server-side issue, but there is a higher possibility that the problem has occurred on the client side instead. It could be your personal computer, internet connection, or any device that you used to launch these platforms.

Since it’s mostly due to incompatibility or unsupported headers by the server, you can expect this error on any platform, whether it is Netflix, Amazon Prime, Hulu, etc.

Also, we can’t explain every step to troubleshoot the 406 error on each of these platforms. However, you can follow these basic steps for each platform and see if the error is fixed.

  • Restart your network device, such as a router by switching it off or unplugging it from the power source > Wait for a while (about 2 minutes) > Plug it back and turn on the device.
  • Similarly, you can also restart your gaming system, personal computer, OTT devices, etc.
  • Try connecting your streaming device to another network, such as WLAN or Mobile network, and check if the error persists.
  • Check the streaming media app’s current version and update it if available.
  • If none of the above methods work, the best thing you can do is to search for the Forums and guides available online on each streaming platform.

3. Rollback your recent WordPress updates

Note: Before attempting to change anything on the website, the first thing you need to do is a complete backup of your website as a precautionary measure. So that, if anything goes wrong, you can still get back to your website unharmed.

If you have recently updated your WordPress just before the 406 error code appeared, consider rolling back to its previous version immediately.

For your reference, you can check out this dedicated post “How To Reinstall WordPress? 4 Best Methods To Follow“.

Similarly, any extensions or modules you recently upgraded can also cause server-side issues, so reverting to previous versions of those may also help. 

4. Uninstall Recently added Extensions, Plugins, or Themes

If you have recently added any Extension, plugin, or Theme regardless of what Content Management system you are using, and see an error 406 afterward. It is better to check if they were creating the issue.

This is because these plugins or themes have access to your database and can make changes to it, such as adding extra code to your site files or altering database records. These actions may lead to the occurrence of an HTTP error 406.

The best approach to figure out the problematic plugins or themes is to deactivate them one by one and see if the error 406 is still showing up. If the error disappears, the deactivated plugin or theme is more likely to be the culprit.

Deactivate Plugin
Deactivate Plugin

5. Look for any Database records changes

As mentioned in the above section, certain plugins and themes can have the power to modify or alter your database records. Consequently, even after removing or uninstalling them from your WordPress dashboard, some traces may still be present in the database.

These traces can still be responsible for triggering the error 406.

The best thing you can do is to open the database by using Adminer or phpMyAdmin and check out the tables.

Check the WordPress tables and records that were likely to be modified by the Plugins or themes.

Checking WordPress Database
Checking database

Info:If your website is hosted on a WPOven server, you can easily access your Database via the Database Manager Tool.


Server-side Solutions

In case you are not using any CMS such as WordPress or after trying all the above methods still encountering HTTP error 406. Here are some other troubleshooting methods you can follow on the server side.

6. Check Server Logs

One of the best tricks to check if anything went wrong on the server side is checking the Server logs. Regardless of what CMS, website platform, or web application you use, they all have server-side logs available.

These server logs contain critical information about the health and status of the server or hardware used to run the web application.


Read: 🚩 For a WordPress site, How to Set up and Use WordPress Error Log?
For WPOven users, Read: How do I see my access and error logs?


7. Check the Web server configuration

If you are unable to resolve the “406 Not Acceptable” error, the next step is to check your web server configuration files. This error typically indicates that the web server is restricting users from accessing a specific URL.

Hence, it is necessary to inspect or check your web server configuration for any request handling instructions or unintentional redirections.

To inspect your web server configuration, the first step is to determine which server software your website uses. It can be either NGINX or Apache.

If your website uses Apache, look out for the .htaccess file in the root directory of your website’s system files. However, if your website is using the NGINX web server, you have to look for the NGINX.conf file instead.

You can also check out our dedicated article on, “WordPress .htaccess File: How to Create And Edit it?

Once you can locate the .htaccess file, open it up in the text editor and search for the directives that are using the 406 flags.

For example, here is a block directive (i.e., a named set of directives) that configures a virtual server for WPOven.com and ensures that similar to above, a request to 

https://wpoven.com./users/json that doesn’t include an Accept: application/JSON request header will fail and is met with a 406 response code:

server {
listen 80;
listen 443 ssl;
server_name wpoven.com;
location /users/json {
if ($http_accept != application/json) {
return 406 https://wpoven.com/users/json$request_uri;
}
}
}

Now you need to thoroughly look at your nginx.conf file and see if there any suspicious, abnormal directives or lines are present that have 406 flags included. If found any, mark it as a “comment” and then restart your server to see if the error disappears.

8. Debugging WordPress

As we have mentioned earlier many web applications provide you with error logs and even debugging along with it.

Debugging is a process that involves finding out the smaller bugs or errors in the codes of the application and removing them. To learn more about WordPress debugging check out our dedicated post on “WordPress Debugging: How To Enable WP_DEBUG?

9. Check Server Security Rules

  • Server’s security rules target to protect your server and website from malicious activities such as DDoS attacks etc.
  • But sometimes, these rules might be overly strict leading to the blocking of legitimate requests and triggering the 406 error code.
  • For example, if the security rule is configured to block requests from particular IP addresses, it can unintentionally also block genuine users as well.
  • To avoid such a situation, it is important to check your server security rules and if possible, make little adjustments to allow valid requests without violating the protection and functionality of the website.

How to prevent 406 Error?

To prevent a 406 error on your website, consider implementing the following Dos and Don’ts.

  • Review Security Rules:
    • Check and review the security rules implemented on your server. Ensure they are configured to be robust but not overly strict.
    • If possible, customize security rules to allow necessary and legitimate requests.
  • Update Plugins and Themes:
    • Keep your plugins and themes up to date. Developers often release updates to address bugs and improve compatibility, reducing the likelihood of conflicts leading to 406 errors.
  • Monitor Server Logs:
    • Regularly check server logs for any unusual activities or error messages. Address any issues promptly to prevent them from escalating into 406 errors.
  • Test Changes:
    • Before implementing significant changes, such as adding new plugins or themes, test them in a staging environment. This allows you to identify and resolve potential conflicts before they affect the live site. Also don’t modify or make changes to your WordPress core files unless it is very necessary.
  • Install Trusted Plugins or themes only:
    • Always try to install a reputable and trusted plugin, themes, or extensions only if necessary.
  • Database Cleanup:
    • From time to time always clean up or optimize your database by removing junk files and traces of removed plugins.
  • Implement Debugging periodically:
    • Make it a routine to debug your server periodically. This will make your server a healthy and smoother website experience for your visitors.
  • Consult Hosting Provider:
    • If your website is hosted, consult your hosting provider for assistance. They may be able to identify server-side issues or help you optimize server settings to avoid 406 errors.
  • Use a Content Delivery Network (CDN):
    • Implementing a CDN can help distribute your website’s content efficiently and reduce the likelihood of server-related errors, including 406 errors.
  • Regular Backups:
    • Regularly back up your website. In case an error occurs, having a recent backup allows you to restore your website to a working state quickly.

Conclusion

Just like any HTTP error, you can fix the 406 Not Acceptable error. However, the initial step you need to take is to figure out the underlying cause that triggered it.

Since it is not a common HTTP error code, you may still encounter it from time to time if it is not properly configured.

If you have any suggestions or queries to ask regarding this 406 error, please do let us know in the comment section below.


Frequently Asked Questions

How do I fix error 406?

You can easily fix error 406 by following these troubleshooting methods:
1. Check whether the entered URL is correct or not
2. Reset and Configure your Network and Devices
3. Rollback your recent WordPress updates
4. Uninstall Recently added Extensions, Plugins, or Themes
5. Look for any Database records changes
6. Check Server Logs
7. Check the Web server configuration
8. Debugging WordPress
9. Check Server Security Rules

What is the meaning of 406?

The error 406 code means the client’s request is not acceptable to the server. It triggers when the server cannot able to generate a response that matches the list of acceptable values specified in the request headers.

What is the difference between HTTP 404 and 406?

HTTP 404 Not Found Indicates that the server couldn’t find the requested resource, often due to a missing webpage or incorrect URL. Whereas, the HTTP 406 Not Acceptable, indicates that the server cannot produce a response matching the criteria specified in the request headers, such as content types or languages. It occurs when the server cannot meet the client’s specified requirements.


Leave a Reply

Your email address will not be published. Required fields are marked *