502 status code sending files over HTTP (AT+QHTTPPOSTFILE)

I am using a EG916Q-GL module. I’m receiving 502 HTTP status codes intermittently when trying to POST files. I’m uploading photos to a server. Typically the requests are successful in less than 10 seconds. However, occasionally I receive a 502.

On the server side (Nginx), client_body_timeout is 60 seconds. When the issue occurs, Nginx logs a 408 for the POST. This timeout triggers when no new bytes of the request body are received for 60 seconds (idle gap), not when the total upload exceeds 60 seconds.

My interpretation is the EG91 module initiates the request but then sending halts for more than 60 seconds.

Using another module, the BG95, which is cat-1, I never encounter this issue.

This problem feels like a issue with the module and not a network connection or server problem.

Device info:

AT+QGMR
EG916QGLLGR01A05M04_A0.300.A0.300

File sending process:

AT+QFOPEN="photo.jpg"
+QFOPEN: 1027
OK

AT+QFWRITE=1027,62476,5
CONNECT
+QFWRITE: 62476,62476
OK

AT+QFCLOSE=1027
OK

AT+QHTTPURL=35,20
CONNECT
OK

AT+QHTTPPOSTFILE="photo.jpg",180
OK
+QHTTPPOSTFILE: 0,502,122  # 64 seconds later

When successful:

AT+QHTTPPOSTFILE="photo.jpg",180
OK
+QHTTPPOSTFILE: 0,200. # 7 seconds later

AT+QHTTPREAD=60
CONNECT
{"picture":{"id":123213,"photo_url":"https://example.com/photo.jpg"}}
OK
+QHTTPREAD: 0

I generate a full HTTP POST (headers+multipart body) and save it to a file and then send it with AT+QHTTPPOSTFILE. Below is what my request looks like. The BG95 is stable but EG91 sometimes stalls until the server times out the request.

POST /api/v1/picture HTTP/1.1
Host: example.com
Content-Type: multipart/form-data; boundary=---mpsboundary
Content-Length: 47788
X-User-Email: api@example.com
X-User-Token: user_token

-----mpsboundary
Content-Disposition: form-data; name="picture[taken_at]"

2023-04-12T20:28:19Z
-----mpsboundary Content-Disposition: form-data; name="picture[picture_type]"

InitialPicture
-----mpsboundary Content-Disposition: form-data; name="picture[file_name]"

2dcvatwry5snal0.jpg
-----mpsboundary
Content-Disposition: form-data; name="picture[photo]"; filename="2dcvatwry5snal0.jpg"
Content-Type: image/jpeg

# image bytes here
-----mpsboundary--

Dear Customer,

We are sorry for late response.

Could you help verify the current firmware version being used in the EG916Q‑GL module

Best Regards,
Fazrul Redzuan

As stated in the original post: EG916QGLLGR01A05M04_A0.300.A0.300. Are you looking for something else?

Dear Customer,

Thank you for your patience.

Based on your issue, Can you help to increase timeout value? Maybe we can try to identify through the timeout since 502 is related to timeout.

image

Best regards,
Fazrul Redzuan