如果客戶端發出請求的URL頭部信息過大,網站將不能及時響應,並通過狀態碼414報錯.
<center><h1>414 Request-URI Too Large</h1></center>
對此問題,可在Nginx的http容器中優化參數:
[root@proxy ~]# vim /usr/local/nginx/conf/nginx.conf ... http { client_header_buffer_size 1k; #默認請求包頭信息的緩存 large_client_header_buffers 4 4k; #大請求的包頭部信息緩存個數與容量 ... } [root@proxy ~]# /usr/local/nginx/sbin/nginx -s reload #重啟加載配置
可以用如下的腳本測試下,問題是否改善:
[root@proxy ~]#vim buffer.sh #!/bin/bash URL=http://192.168.4.5/index.html? #這里定義要測試的網址 for i in {1..5000} do URL=${URL}v$i=$i done curl $URL
[root@proxy ~]# ./buffer.sh