I have a spring boot application where the controller is consuming the post request of content-type "multipart/form-data". This code is working when the image size is less than 1MB but if I upload any image of size more than 1MB, I always encounter this error. This error only appears in the production environment. In the local system, this is working perfectly fine. Error
I have already increased the default size of the multipart file max size in the spring boot application property file.
#Spring max size upload
spring.servlet.multipart.max-file-size=10MB
spring.servlet.multipart.max-request-size=10MB
spring.servlet.multipart.enabled=true
#Server properties
server.tomcat.max-http-post-size=100000000
server.tomcat.max-swallow-size=100000000
I was using the Nginx for the load balancing that was the issue. When I increase the size of Nginx from AWS. The error got resolved.
I followed this blog to increase the size. You must need the root permission to update your Nginx configuration file
https://medium.com/@ghazaltaimur27/change-file-upload-limit-in-ngnix-in-aws-server-2820c491e9a4
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.