0

Hope someone can help me with the error I could not resolve.
Scenario: Changing default upload limit 1MB by using client_max_body_size 10m; works without any problem while uploading file without using docker container. But when using it with nginx:latest docker container the setting configured for the docker is not being reflected and 413 Request Entity Too Large is being produced while uploading files > 1MB(nginx default limit).

There are three containers

  1. nginx
  2. mariadb
  3. express pm2 app using axios

P.S upload limit is already handled for express middleware.

app.use(express.json({ extended: true, limit: '10mb' }));
app.use(express.urlencoded({ extended: true, limit: '10mb' }));

docker-compose.yml

services:
  nginx:
    image: nginx:latest
    container_name: app_nginx
    restart: always
    ports:
      - 80:80
      - 443:443
    volumes:
      - ./nginx/conf.d/app.conf:/etc/nginx/conf.d/app.conf
      - ./nginx/ssl:/etc/nginx/ssl
      - ./nginx/logs:/var/log/nginx

app.conf

server {
  listen 443 ssl;
  ssl_certificate /etc/nginx/ssl/server.crt;
  ssl_certificate_key /etc/nginx/ssl/server.key;

 location / {
  ...
  client_max_body_size 10m;

  ...
 }

}

0 Answers0