Errors on the client and server side can happen (such as 406 error), and these are commonly referred to as HTTP responses or status codes. This HTTP response code is known as the "406 error".
When visiting a site, you might encounter a 406 error. If you have a website, it might be even worse. Internet users may find it irritating, but website or application owners might find it absolutely terrifying. Any HTTP response code, including the 406 error, can make an otherwise professional website seem unprofessional and confusing.
What is 406 error?
"406 Not Acceptable" HTTP error messages aren't as common as "404 Not Found" errors (which usually indicate that URLs don't exist) or even the 301 or 500 HTTP problems. As a result, you shouldn't expect to see much of this one.
The status code 406 Not Acceptable is an HTTP response code. When user agents (web browsers) request information from the server, they provide an Accept header that notifies the server which data types the browser may accept. If the server is unable to transmit data in any of the codecs specified in the Accept header, a 406 Not Acceptable error will be returned.
Although the 406 error is uncommon, it is possible that it will cause an issue for your website.
The message usually goes like this:
An appropriate representation of the requested resource could not be found on this server.
Additional messages or server information are mentioned at the end, and it sometimes indicates the "requested resource" where the problem is.
Is 406 error a server-side or a client-side error?
A client-side error is the 406 Not Acceptable status code. It belongs to the 4xx (The 4xx status code class is for situations where the client appears to have made a mistake) category of HTTP response status codes, which are client error responses.
HTTP status codes in the 4xx category include:
- 400 Bad Request
- 401 Unauthorized Error
- 403 Forbidden
- 404 Not Found
- 405 Method Not Allowed
- 410 Gone
- 429 Too Many Requests
- 415 Unsupported Media Type
4xx errors imply that the intended page was not located and that the request was incomplete. The problem is something that is occurring on the client's end.
They differ from the 5xx category of status codes, which are considered server-side faults. These errors are not the fault of the client, but they do indicate a problem on the server-side
A 406 Not Acceptable error can sometimes be traced back to the server. It can, for example, result in a 406 code response and other significant traffic routing issues if it is misconfigured and handling requests incorrectly.
What are the causes of 406 error?
Your browser (such as Safari, Firefox, Brave, Chrome, or Internet Explorer) requests site files and content whenever you open a web page. By communicating with the server, the browser notifies the server what the user wants to see, and hopefully, the server replies with the correct information.
When the browser sends its first request, it informs the server what file types it can accept. Essentially it's an Accept-Header request, which tells the server to deliver the files in the proper formats in order to produce the entire website or web application, beginning with the header.
A server's response may not respect a browser's or a client's rule when it is not in the appropriate format. This error indicates that the server isn't delivering the required data, as indicated by a 406 error.
In header requests, there can be some "bad formats" and "rule violations". Here are some examples:
- Accept-ranges: Some servers use security measures or only allow a specified file size limit in the response. You'll get a 406 error if the answer tries to send too many bytes outside the allowed range.
- Accept-encoding: This section of the header is used to compress files so they can be sent from the server to the browser fast. A 406 error code is generated when certain encoding methods and formats aren't accepted.
- Accept-language: Accept-language is a nickname for Accept-charset that refers to its emphasis on worldwide languages.
- MIME type violation: The browser may occasionally ask the server for a certain MIME type. JPEG photos, particular video formats, and basic text are examples of MIME types. You'll get a 406 error if the server can't offer a specified MIME type, such as JPEG images.
- Accept-charset: This is a character set that describes how site file tables convert code (such as CSS and HTML) into readable characters. It's difficult to cover all of the characters, languages, and symbols that exist around the globe. The ISO-8859 table is the standard, although there are also various complementing tables. To keep up with language and character additions, new character tables are released on a regular basis.
The "406 Not Acceptable" error indicates that the client provided a legitimate request to the web server, but that the request included a special criterion that the server must comply with. The initial request included a particular need in the form of an HTTP Accept- header.
That leaves us just a few possibilities or causes:
- The desired MIME type or suitable formats, such as JPEG or mp4 video, were not provided by the server.
- The server did not provide the appropriate language (Accept-language).
- In accordance with the Accept-encoding request, the server utilized the incorrect compression method or format.
- The server returned an excessive number of bytes that did not match the Accept-ranges request.
- The server failed to deliver comprehensible characters, resulting in an issue with the browser's Accept-charset request.
The 406 error can be caused by other things, but they aren't as common. The first two are more prevalent than the others, so it's likely you should start by looking into the possibility of a MIME type violation or an Accept-language issue.
Seeing how something within your site files might cause problems is key information for website owners regarding these format issues and violations. Human error, such as entering in the wrong code, removing vital code, or misconfiguring the server, frequently results in such scenarios. When specific security settings or regulations prevent content delivery from the server, the 406 error arises.
What are some preventative measures for 406 error?
The issue with the 406 error is that it might appear in a variety of circumstances.
That's not ideal, but it's nothing that a little troubleshooting can't fix. When the 406 error occurs on your website or app, it is much more problematic.
If it's your website, you'll want to make sure it doesn't happen again. Plugins, themes, and human mistakes can all play a role, so here are some additional recommendations.
- Keep plugins, themes, and extensions to a minimum. Only install the necessary and reputable elements.
- Unless you know what you are doing and absolutely must, you should never edit the core files of WordPress.
- It is recommended to perform a database cleaner and site optimizer regularly. We recommend that this process is completed every month and that a cleaner plugin is used that will run automatically in the background.
- Debugging your server and web application should become a habit.
- Backup your website or application regularly. This will prevent code conflicts or errors from causing too much anxiety since you can easily restore a previous version of the site.
- Even if you already run automated backups, run a manual backup of your site before updating WordPress and any plugins. It's also a good idea to take a backup before editing any files or adding new code to your site.
How to fix 406 error?
Go into your WordPress site's file manager. Enter the publi_html and right click on .htaccess to edit
Enter the following code at the end of the file and click save. This will resolve the 406 error, please note that for below solution to work you either need to have your site on LiteSpeed Enterprise or Apache, even on NGINX this below solution will not work.
<IfModule mod_security.c> SecFilterEngineOff SecFilterScanPOSTOff </IfModule>
When browsing a website, you may see the 406 error. Or, in the worst-case scenario, on your website. While it may annoy the typical internet user, it can be downright frightening for the owner of a website or service. Any HTTP response code, even the 406 error, might lose sales and users in addition to seeming unprofessional and unclear.
There are various methods for resolving the 406 error. You should be able to clear up the mistake as long as you know what you're seeing and where to seek for the solution.
While this isn't one of the most common WordPress issues, it is one that you may encounter if your configuration is incorrect.