Quectel EG91 HTTP post issue

Hi, I’m using Quectel EG91 with STM micro-controller via UART to send a half MB size binary file to s3 bucket. The HTTP method I’m using is PUT request. The modem works fine but sometimes it gets stuck and returns back 400 error code. The sequence of AT commands is as follows:

at+qhttppost=<http request + payload total length>,60,80

The bucket is public so no ssl configurations are required at the moment. The only thing I don’t understand is that sometimes it works fine and will upload the binary file continuously but sometimes it will just give me 400 error (+QHTTPOST: 0,400)

Any help would me much appreciated. Thanks

400 is an HTTP status code,400 indicates “Bad Request”.
1.Semantic error,The current request is not understood by the server;
2.The request parameters are incorrect.
According to the judgment, HTTP access response timeout or no response resulted in 400 error code.

I have not changed the HTTP request at all that is why sometime it works perfectly fine and sometime it gives me 400 bad request error. I tried increasing the max input time of AT+QHTTPPOST but the behaviour is the same. The only thing is the MCU takes good time to upload the half MB file to the modem in chunks (about 1 minute or so). Is there any difference in the performance of the modem by using AT+QHTTPPOST and AT+QHTTPPOSTFILE?