This day I have to update a website based on Codeigniter, 1.54. When trying on the development environment, all running smoothly, but when transferred to the server some problems arise.
In part used session function (I use the library session Codeigniter) , randomly displays a HTTP 406 error.
When searching on google, I know that the problem is probably caused by the Apache mod_security. I tried de-active mod_security function using . htaccess files but it causes HTTP error 500.
When a page that uses session displays a HTTP 406 error, It can be fixed by delete computer cookies, but sometimes it comes back HTTP error 406 at random.
Another problem, the session produced by the library Codeigniter likely trigger mod_security apache and the mod_security considers it as a threat so mod_security block access from my IP (I have many times to reset my modem to get a new IP)
My solution : I change my session from the Codeigniter library into Native PHP session. The solution worked perfectly, I don’t have anymore HTTP error 406 and blocked by mod_security.