How do I correct a 406 error on cPanel?

Procédure

An HTTP 406 Not Acceptable error is a status code returned by a web server when the server is unable to provide a response corresponding to the accepted criteria sent by the client in the request headers. This essentially means that the requested content exists, but is not available in a format suitable for the client's preferences, as defined in the Accept header of the HTTP request.

What is a 406 error?

An HTTP 406 error occurs when a client, such as a web browser, requests a specific resource, but also specifies in the Accept header that it will not accept certain types of data. If the server cannot respond with a content type that matches the criteria defined by the client, it will return a 406 error. This situation is more common with web APIs and services that support multiple data formats (such as JSON, XML) and where the client has strict requirements regarding the response format.

Common reasons for a 406 error include:

  • Accept headers that are too restrictive: The client requests the resource in a specific format that the server cannot provide.
  • Server configuration: The server is configured in such a way as not to provide certain types of content or data formats, even if they are technically supported by the application.
  • Poor content negotiation: The server's content negotiation logic, which is supposed to select the best type of content to send based on the client's Accept headers, is faulty or misconfigured.
  • Lack of alternative formats: The server does not have alternative representations of the requested resource that could satisfy the client's preferences.

How can I resolve error 406?

On cPanel, the 406 Not Acceptable error is most often generated by the ModSecurity application firewall.

1. Connect to your cPanel interface.

2. Go to the "Security" section and click on the "ModSecurity" button:

How do I correct a 406 error on cPanel?

3. You can see the blocks made by ModSecurity by clicking on the "View history" button corresponding to your domain name:

How do I correct a 406 error on cPanel?

The rules triggered by modsecurity on your site or application are then listed.

How do I correct a 406 error on cPanel?

Retrieve the rule number corresponding to your block and deactivate it.

Note that a block may not appear on the block history until 5 to 10 minutes after the event.

Conclusion

You now know how to :

  • Identify an HTTP 406 Not Acceptable error and its common causes, such as Accept headers that are too restrictive, inadequate server configuration, poor content negotiation or the absence of alternative formats.
  • To resolve error 406 on cPanel, log in to your interface, access the "Security" section, click on "ModSecurity" and deactivate the rules blocking your content.

🛠️ With this information, you're armed to deal with this error and ensure a smooth user experience on your website or API. 😊

We hope this article has helped you better understand and resolve issues related to the 406 Not Acceptable error. Thank you for reading! 👍 Please feel free to share your experiences or ask questions by leaving a comment below. Your feedback is invaluable in helping us improve our services!

Rate this article :

This article was useful to you ?

Article utileYes

Article non utileNo

Vous souhaitez nous laisser un commentaire concernant cet article ?

Si cela concerne une erreur dans la documentation ou un manque d'informations, n'hésitez pas à nous en faire part depuis le formulaire.

Pour toute question non liée à cette documentation ou problème technique sur l'un de vos services, contactez le support commercial ou le support technique

MerciMerci ! N'hésitez pas à poser des questions sur nos documentations si vous souhaitez plus d'informations et nous aider à les améliorer.


Vous avez noté 0 étoile(s)

Similar articles

3mn reading

Wordpress on cPanel: Solving the white page or 500 error problem

1mn reading

How to view Apache and PHP log files on cPanel

1mn reading

Diagnose and correct a 500 error on a site hosted on cPanel

0mn reading

How do I correct a 403 Forbidden error on cPanel?


Ask the LWS team and its community a question