GV.

Sunday, September 26 2021

How To Fix Upload FileSize too large error in Strapi in AWS beanstalk?

Strapi file size can be increased in the config file but there is an additional error you will encounter if you have deployed your application in AWS Beanstalk. This happens because, The proxy server used by beanstalk, Nginx also has a filesize limit. We need to increase this too in addition to increasing it in Strapi.

Increasing file size limit in Strapi

File to edit config/middleware.js

module.exports = {
  load: {
    after: ["parser", "router"],
  },
  settings: {
    parser: {
      enabled: true,
      multipart: true,
      formidable: {
        maxFileSize: 100 * 1024 * 1024,
      },
    },
  },
};

Increasing file size limit in Nginx

File .ebextensions/nginx/conf.d/elasticbeanstalk/my-server-conf.conf

server {
    client_max_body_size 100M;
}