简体   繁体   中英

How to solve 413 request entity too large

When I post a form with an image taken from my phone I reserve the error "413 request entity too large" I realize that an image included in the form taken by the phone camera is too large, and the server rejects the request... but how can I fix this issue, I'm using Java Spring framework, and MySQL database, all of this handled with Amazon aws services.

You have to modify your .platform as shown in the docs .

For example, you could have the following .platform/nginx/conf.d/myconfig.conf with content:

client_max_body_size 20M;

I struggled with this for so long until I came across this post:

https://medium.com/@robin.srimal/how-to-fix-a-413-request-entity-too-large-error-on-aws-elastic-beanstalk-ac2bb15f244d

Couple things to watch out for here, if your server is restarted or you deploy a new version etc, then your nginx server will also reset and you will need to perform these changes again. Also periodically, AWS seems to reset your EC2 instance address, not sure why, but you need to perform these changes again afterwards. There must be a way of making these changes permanent but I haven't figured that part out yet.

I find the solution thanks for helping... 1-I connect to my EC2 instance throw the "connect" button, a terminal appears. 2-I edit this file: etc/nginx/nginx.conf 3- Add this line:client_max_body_size 10M; and it works fine. thank you all;

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM