Answer the question
In order to leave comments, you need to log in
Why is django closing the connection prematurely?
Good afternoon. I ran into an annoying problem when sending requests from mobile applications to a Web API written in Django. During some requests, the connection is reset. Began to understand. As a result, I figured out such a simple django application . Easier already nowhere.
We call the /test/ method using the POST method and transfer some ~15MB binary data there,
test with curl and postman
on curl, everything is OK:
curl -X POST -d "@bin/ngrok" localhost:3000/test/
Answer the question
In order to leave comments, you need to log in
In general, I found the answer. The fact is that Django starts sending the response before the client has time to send the request body in full. Apparently some HTTP clients are not designed for this. You just need to refer to request.body, and wait until it is all loaded, and only after that start scribbling the response
In fact, Django never handles requests alone. It still has gunicorn/uwsgi/mod_wsgi and nginx or Apache in front of it. In addition, the restrictions on the size of the request are described right in the documentation .
Well, it would be nice to give the code and text of the error in such questions.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question