springboot项目报错Request header is too large之解决方案

转载文章来源:https://blog.csdn.net/aa292016616/article/details/80599149

这是由于tomcat限制了header的长度,如果你请求的数据量超过了默认的长度就会抛出越界,

解决方法有如下两种(视项目而定):

    1.springboot是内置tomcat的所以不能修改tomcat的文件内容,在springboot的xxxx.yml加上

server:
  #tomcat:
    #max-http-post-size: -1
  max-http-header-size: 4048576


即可如果配置文件类型为xxxx.propertis则

server.max-http-header-size=4048576
 
如果报的是post的长度限制则加上,大小自己定义
max-http-post-size
2.修改tomcat中的server.xml

    在此处加上

 maxPostSize="8000000"
  <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" maxPostSize="8000000"/>

发布了23 篇原创文章 · 获赞 7 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/ghd602338792/article/details/89183822
今日推荐