admin管理员组文章数量:1608599
SpirngBoot项目启动后没报错,但是用postman测试接口的时候发现会间歇式(一好一坏)出现错误:
Error parsing HTTP request header
Note: further occurrences of HTTP request parsing errors will be logged at DEBUG level.
java.lang.IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokens
单纯的出现也很正常,它却一次成功一次错误的,弄得我不知所措。
查阅网上资料,98%都说tomcat的header最大值配置更改就好了,但是springboot都是内置的tomcat,
修改的方法是:server.tomcat.max-http-header-size=8192
但是这个配置已经被高版本的boot项目废掉了,
可以改为: server.max-http-header-size=8192
满心欢喜,以为好了,然后发现并没有。
另外2%说可能和HTTPS协议有关,改为HTTP即可。
但是我这是本地启动的,一直都是HTTP。
纠结许久我发现罪魁祸首竟然是在请求的时候Header里面加上了Content-Length,并给了他定值,所以会报错。蠢哭~~
对于大家说的修改max-http-header-size的作用,我把这个设置为1,再次请求发现报的错和我这之前的并不一样,而是:
Error processing request
org.apache.coyote.http11.HeadersTooLargeException: An attempt was made to write more data to the response headers than there was room available in the buffer.
本文标签: 报错项目parsingErrorSpringBoot
版权声明:本文标题:SpringBoot项目报错:Error parsing HTTP request headerNote: further occurrences of HTTP request parsing 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/xitong/1728548638a1163162.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论