mohammad
mohammad

Reputation: 2198

nginx + gunicorn 400 error

I have setup my server to use nginx plus gunicorn for hosting a project. When I send POST request of small sizes everything is OK. But when I send POST requests of size about 5MB I get 400 error from server.

I had set client_max_body_size in my nginx configuration to 100M. Can anyone help with this error? Following is how I send request to server :

r = requests.post(url, json=data, timeout=180, cookies=cookies, headers=headers)

400 Error depends on data size. With large data size I get this error!

Upvotes: 2

Views: 507

Answers (1)

mohammad
mohammad

Reputation: 2198

By the link suggested in comments I ran Gunicorn from command line and send big data request. I saw Gunicorn was experiencing :

Request body exceeded settings.DATA_UPLOAD_MAX_MEMORY_SIZE error.

As documentations says default value is set to about 2.5MB. https://docs.djangoproject.com/en/dev/ref/settings/#data-upload-max-memory-size. After setting it to None Problem solved.

Strange thing is that I didn't get any error in my django project logs!

Upvotes: 2

Related Questions