I'm using jQuery to post some form data to my Nginx server but sometimes it fails with a 408 error. When the error happens, apparently the php script to process the posted data is NOT reached at all, as I put some logging function in the first line. And the most weird part is, with the same form data, sometimes the script works, sometimes not. I couldn't figure out why.
Browser: Microsoft Edge 101.0.1210.32
jQuery:1.12.4, code of posting data as below:
$.ajax({
url: 'save.php',
dataType: 'json',
type: 'post',
contentType: 'application/json',
data: JSON.stringify( { "comment": comment,"id":id} ),
processData: false
});
Nginx log:
[03/May/2022:15:11:01 +0700] "POST /save.php HTTP/1.1" 408 0 ...
Nginx conf:
client_max_body_size 10M;
client_body_buffer_size 2048k;
client_header_timeout 60s;
client_body_timeout 60s;
keepalive_timeout 60s;