我在Wildfly中有一个 Web 应用程序,当我尝试上传大于 10MB 的文件时,出现以下错误:
io.undertow.server.RequestTooBigException: UT000020: Connection terminated as request was larger than 10485760
Run Code Online (Sandbox Code Playgroud)
请问,我该如何解决这个错误?
Thi*_*ves 11
我通过将max-post-size放入standalone.xml 中解决了我的问题,如下例所示:
<subsystem xmlns="urn:jboss:domain:undertow:3.1">
<buffer-cache name="default"/>
<server name="default-server">
<ajp-listener name="ajp" max-post-size="1073741824" socket-binding="ajp"/>
<http-listener name="default" max-post-size="1073741824" socket-binding="http" redirect-socket="https"/>
<https-listener name="https" max-post-size="1073741824" socket-binding="https" security-realm="ApplicationRealm"/>
...
</server>
...
Run Code Online (Sandbox Code Playgroud)
在此示例中,该值配置为 1GB,但您可以配置您想要的值。
如果您使用 Nginx,请不要忘记配置client_max_body_size。
有用的网址:
https://access.redhat.com/solutions/3084671
http://www.mastertheboss.com/web/jboss-web-server/configuring-wildfly-upload-file-size/