When using Nginx, when uploading images asynchronously to the server, found to throw "error" errors, carefully found that the throw error content is: 413-request Entity Too Large, see the Tomcat run log when the background did not receive a file upload request, Finally found that Nginx limited the size of the file upload, directly intercepted the request. This error is due to nginx default upload file size configuration client_max_body_size only 2MB.
Workaround:
1, spring MVC upload files when the profile upload size (usually must be set, although I am not the reason)
<!--file Upload--<bean id= "Multipartresolver" class= " Org.springframework.web.multipart.commons.CommonsMultipartResolver "> <property name=" defaultencoding "value = "UTF-8" ></property> <property name= "maxuploadsize" value= "99999999999" ></property> < Property Name= "Resolvelazily" value= "true" ></property> </bean>
2, modify the Nginx server reverse proxy configuration file
Last reboot Nginx:./nginx-s Reload
Reference article: 51992986
Upload file limit causes 413-request Entity Too Large