出现这个原因是post请求时,tomcat限制了post请求参数的大小,只需要在server.xml中找到Connector 节点并用以下代码覆盖
IDEA集成tomcat之后,也会出现此问题,解决办法同样找server.xml添加上述代码,server.xml位置如下图
1.找到自己Tomcat所在目录。
点击运行按钮旁边的tomcat,进入Edit Cofigurations,红色框就是tomcat所在位置。
2.server.xml文件就位于config目录下修改 Connector节点即可。
如果是SpringBoot项目,在application.properties文件中添加
server.max-http-header-size=102400
如果是线上项目出现此情况,修改ngnix即可
其中ngnix.conf修改如下:
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
client_header_buffer_size 10240k;
large_client_header_buffers 6 10240k;
}