HTTP 408 Request body incomplete

784 Views Asked by At

Attempting to make a POST request I am getting the following response:

HTTP/1.1 408 Request body incomplete
Date: Tue, 19 Jul 2022 07:53:39 GMT
Content-Type: text/html; charset=UTF-8
Connection: close
Cache-Control: no-cache, must-revalidate
Timestamp: 09:53:39.074
The request body did not contain the specified number of bytes. Got 62.913, expected 116.798

The error is not shown on Chrome's console, it was found using Fiddler. I can safely say that the service is proven not to be the cause of the issue because it has been installed on different servers and it has always worked, but if it can help track down the problem, here's the call

var postJson = function (url, parameters) {
    forceDateToIsoStringparameters) 
    var deferred = $.Deferred();
    var ajax = $.ajax({
        type: 'POST',
        url: url,
        data: parameters) 
        dataType: 'json'
    }).done(function (data) {
        deferred.resolve(data);
    }).fail(function (error) {
        deferred.reject(error);
    });
    return deferred.promise(ajax);
};

Server settings:
The service that fails is hosted on IIS 8 and has been moved from one server to another with HTTPS protocol set up. It has been working perfectly on the previous server but currently, making some requests that are apparently too large, returns "error 408" responses on some computers via HTTPS. The server has two separate bindings on the same IP and port (443), with two different certificates linked to two different host names.

Server bindings

Furthermore, we increased the request limit size in IIS to one that exceeds that of the body of the failing request.

IIS config

Client settings:
No difference has been found between the PCs where the service responds and others where it doesn't. Both systems run Windows 10 and the connection was performed on Chrome (even in incognito mode). The request body was identical both on working and not working PCs and with the same exact size (116798) On not working PCs, it has been possible to make the call succeed by reducing the size of the body; but we don't understand what setting, either on the server or client-side (PC, router, etc), could cause this behavior

Edit:
After some tests, it appears the problem does not happen with Edge, something in Chrome is truncating the ajax request

1

There are 1 best solutions below

2
On

Try to annotate content-length:116.798 in the header, because there is an error in the server-side length check. If the content-length length is smaller than the actual length, there will be no error, but if the content-length length is larger than the actual length, an error will be reported, resulting in the verification failure.