简体   繁体   中英

'ModSecurity: Error reading request body' when an AJAX request is sent from IE

I'm sending an ajax request using jquery as follows:

        $.ajax({
            url: "lastMessageIndex.php",
            type: "POST",
            data: {room: $("#room").val()}
        }).done(function(data){
            lastMessageIndex = data;
        });

I've tested this in my development environment and it works, I'm getting the expected response from the server, and the script goes on and the webapp works in general. But when I've uploaded it to my remote server, it doesn't, and in the apache2 error.log file I'm seeing the error:

[Sun Oct 28 10:42:46 2012] [error] [client 44.46.23.50] ModSecurity: Error reading request body: Connection reset by peer [hostname "www.mysite.com"] [uri "/ie/IEGetMessages.php"] [unique_id "UI1ujNBx6w4AACW5MkkAAAAF"]

This might not be the actual cause of the problem. I wouldn't mind having errors on the log if I'll be getting the response from the ajax I suppose to. It should be a number eg '4' and what I'm getting is a long string: "warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/tom/mysite.com/lastMessageIndex.php on line 11"


OK, while I was editing this I solved my problem. it's stupid actually, in my dev env, the mySQL database name has a capital letter, on the prod. env it's all lower case.

sorry for the unnecessary mess.

The solution is simple. You don't see that error on your development server because you have not installed Mod_Security on it. Install it, take over the same configuration as from the remove-system and you should see that error on your development system, too.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM