Monday, 18 December 2017

PHP/Apache Error:406 Not Acceptable

PHP/Apache Error:406 Not Acceptable

ContentMiddleAd


This error means that for example, you are asking the server for books (And you only understand Spanish). The server only has English and German Books.
Therefore the server has your answer but it will not give it to you, because he knows you won't do anything useful or you will do something bad with it!! (like not reading the books and throwing them to people's heads, for example).
406 Not Acceptable" is an unusual status code - the most common are 200, 404, 500, 301. You only see a 406 when something is wrong with the server, usually something silly but hard to diagnose.
Also:
This general error means the request you made was detected as a potential hack attempt to the server [...]
https://billing.stablehost.com/knowledgebase/178/What-does-406-Not-Acceptable-mean.html

ContentMiddleAd

The most common solution for this error is related with mod_security.

1. Mod_security

ModSecurity can monitor the HTTP traffic in real time in order to detect attacks [...] it operates as a web intrusion detection tool. ModSecurity can also act immediately to prevent attacks from reaching your web applications.
This 406 error might be from mod_security as a response from a possible attack via POST, passing some url's instead of plain and normal text.
The most common solution is to disable the POST scan and mod_security filtering in htaccess:
<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>
Also, in the terminal, execute:
sudo a2dismod security2_module 
sudo service apache2 restart 
To deactivate ModSecurity.
If that does not work, then edit the file
/etc/apache2/mod-security/modsecurity_crs_10_config.conf
And add a # at the beggining of the line that has something like this:
SecDefaultAction “phase:2,log,deny,status:403,t:lowercase,t:replaceNulls,t:compressWhitespace”
Finally, restart apache
sudo service apache2 restart

No comments:

Post a Comment