Request header is too large 如何解决?

简介: Request header is too large 如何解决?

今天看到群里有小伙伴问,这个异常要怎么解决:

java.lang.IllegalArgumentException: Request header is too large

异常原因

根据Exception MessageRequest header is too large,就可以判断这个错误原因是HTTP请求头过大导致的。

如何解决

解决方法主要两个方向:

方向一: 配置应用服务器使其允许的最大值 > 你实用实用的请求头数据大小

如果用Spring Boot的话,只需要在配置文件里配置这个参数即可:

server.max-http-header-size=

方向二:规避请求头过大的情况

虽然上面的配置可以在解决,但是如果无节制的使用header部分,那么这个参数就会变得不可控。

对于请求头部分的数据其实本身并不建议放太大的数据,所以,还是建议把这些数据放到body里更为合理。

那么当你碰到这个异常的时候,是使用什么方法来解决的呢?Spring 开发遇到问题?来这里提问吧,有问必答!

目录
相关文章
|
5月前
|
中间件 应用服务中间件 Apache
Higress有对max_request_bytes做限制吗?我有个应用上传文件报413 request entity too large错误
Higress有对max_request_bytes做限制吗?我有个应用上传文件报413 request entity too large错误
41 0
|
5月前
|
JSON 数据格式
axios.post请求出错:Request header field content-type is not allowed by Access-Control-Allow-Headers in……
axios.post请求出错:Request header field content-type is not allowed by Access-Control-Allow-Headers in……
|
6月前
|
应用服务中间件 nginx
413 request entity too large 解决办法
413 request entity too large 解决办法
212 0
|
6月前
|
缓存 Linux Apache
Requests Header | Http Header
Requests Header | Http Header
|
10月前
|
前端开发 JavaScript
ajax请求的重定向处理--Request header field x-requested-with is not allowed by Access-Control-Allow-Header
ajax请求的重定向处理--Request header field x-requested-with is not allowed by Access-Control-Allow-Header
319 0
|
12月前
|
测试技术
Elasticsearch-circuit_breaking_exception [parent] Data too large, data for [<http_request>]
Elasticsearch-circuit_breaking_exception [parent] Data too large, data for [<http_request>]
166 0
|
应用服务中间件 微服务
Feign请求中Request header is too large 解决方案
下面介绍Feign请求中Request header is too large 解决方案
|
运维 前端开发 JavaScript
解决 413 Request Entity Too Large
解决 413 Request Entity Too Large
559 0
解决 413 Request Entity Too Large
|
应用服务中间件 nginx
“413 Request Entity Too Large”问题处理
“413 Request Entity Too Large”问题处理
“413 Request Entity Too Large”问题处理