Nginx: Client request body is buffered to a temporary file
Asked Answered
P

1

5

I've deployed a ML Model on AWS. It's an image classifier. When I provide the following images to the ML Model via a form in Flask, it works in certain cases but doesn't work in other cases.

The link of the image which work is listed below: https://drive.google.com/file/d/1hbrEa2gNLdqGPJxp5jVxWcXl1wunp5Mc/view?usp=sharing

The link of the image which gives an error is listed below: https://drive.google.com/file/d/1znWTRnTMPft_r_jwpJ0JQuMnnazsUXs-/view?usp=sharing

Both of the above images look alike. The first image which is around 150kb of size works when I select the file and upload it for analysis. The image which is around 10kb however doesn't when I select and upload it for analysis from a PC. When I try to do the same with my mobile phone browser, both show an error.

The error shown in the logs is - [warn]: a client request body is buffered to a temporary file.

Penguin answered 24/12, 2020 at 6:8 Comment(0)
P
8

I figured out the answer by following this link: Increasing client_max_body_size in Nginx conf on AWS Elastic Beanstalk The nginx configuration settings should be performed in a folder named .platform.

The folder structure is (.platform/nginx/conf.d/proxy.conf)

Inside the proxy.conf mention:

client_body_buffer_size 50M;(the size according to your requirement).

Inside the .platform folder make another file named 00_myconf.config with the following contents:

container_commands:
 01_reload_nginx:
   command: "service nginx reload"

AWS documentation regarding configuring nginx: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/platforms-linux-extend.html (Read the reverse proxy configuration)

Penguin answered 30/12, 2020 at 16:10 Comment(1)
Where exactly in .platform folder should 00_myconf.config file be placed?Septavalent

© 2022 - 2024 — McMap. All rights reserved.