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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM