Reputation: 897
I am using nginx as a reverse proxy. The client application uploads several image files in a POST request. The request is usually between 8M and 9M for the larger requests. I have tried multiple options including setting the client_max_body_size. I have increased the value to 300M. I have also tried some other options.
The nginx configuration file is as follows:
server {
listen 443 ssl ;
server_name app.example.com;
charset utf-8;
client_max_body_size 200M;
# client_body_in_file_only on;
# client_body_temp_path /var/spool/nginx;
# client_body_buffer_size 32K;
location / {
alias /var/www/html/;
try_files $uri /index.html;
}
location /api {
proxy_pass http://localhost:8092/api;
proxy_set_header Host $host;
}
}
The error log is
[error] 22959#22959: *4 client intended to send too large body: 8326396 bytes, client:
Upvotes: 2
Views: 5193
Reputation: 4216
You may be running into config scoping problems, try declaring client_max_body_size 200M;
inside the http{}
block. You will find it on /etc/nginx/nginx.conf
If that doesn't work, try declaring inside the specific location{}
block.
If that doesn't work, maybe there is some error in you configuration which you can check using
$ nginx -t
Try restarting your server instead of only reloading it, if there is no errors with:
$ service nginx restart
If after all that you have no success, maybe you have a problem in your API's max upload size, which varies greatly depending in your's system stack on how to fix it.
Upvotes: 2