Nginx 414 Request-URI Too Large
报错信息:
开发反馈富文本内容太多,发送post请求,Nginx会返回如下报错
<html>
<head>
<title>414 Request-URI Too Large</title>
</head>
<body bgcolor="white">
<center>
<h1>414 Request-URI Too Large</h1>
</center>
<hr>
<center>nginx/1.14.0</center>
</body>
</html>
解决方法:
原因是请求头的长度超出了nginx限制,http块需增加如下参数并reload Nginx。
client_header_buffer_size 512k;
large_client_header_buffers 4 512k;
再次请求Tomcat 或 spring boot会报如下错误:
java.lang.IllegalArgumentException: Request header is too large
因为请求头超过默认的head大小限制,需调大参数
tomcat
在server.xml中增加maxHttpHeaderSize
<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443" maxPostSize="0" maxHttpHeaderSize ="102400"/>
spring boot
在application.properties文件中添加 server.max-http-header-size
server.max-http-header-size=102400