I'm doing some file uploads that sends to an nginx reverse proxy. If I set the python requests timeout
to 10 seconds and upload a large file, nginx will report client prematurely closed connection
and forward an empty body to the server. If I remove the requests timeout, the file uploads without any issues. As I understand it, the timeout should only apply if the client fails to receive or send any bytes, which I don't believe is the case as it's in the middle of uploading the file. It seems to behave more like a time limit, cutting the connection after 10 seconds with no exception being raised by requests. Is sending bytes different than reading bytes for timeout? I haven't set anything for stream
or tried any type of multi-part. I would like to set a timeout but confused as to why the connection is getting aborted early - thanks for any help.
Asked
Active
Viewed 138 times
1

ElJeffe
- 637
- 1
- 8
- 20
-
How did you work around this? – Idea Inside Mar 14 '23 at 20:30
-
I can't recall if I removed the timeout entirely or set it to something like 10 minutes. Seems like it shouldn't disconnect if it's sending data, but I never got an explanation or solution. It wasn't nginx cutting the connection. It was determined to be the client request post timeout. – ElJeffe Mar 18 '23 at 13:40