nginx-499狀態碼

一.499是nginx自定義的http狀態碼。

在源碼中有這麼一段說明

/*

 * HTTP does not define the code for the case when a client closed

 * the connection while we are processing its request so we introduce

 * own code to log such situation when a client has closed the connection

 * before we even try to send the HTTP header to it

 */

nginx定義的一個狀態碼,用於表示這樣的錯誤:服務器返回http頭之前,客戶端就提前關閉了http連接,這很有可能是因爲服務器端處理的時間過長或者客戶端網絡異常。


二.proxy_ignore_client_abort

Determines whether the connection with a proxied server should be closed when a client closes the connection without waiting for a response.

當客戶端沒有等待服務器返回就主動關閉連接時,服務端要不要關閉客戶端連接。


1.關閉時:如果客戶端端主動關閉請求或者客戶端網絡斷掉,Nginx會記錄499,同時request_time是後端已經處理的時間,而upstream_response_time爲“-“。

日誌格式:[$time_local] $request_length $status $upstream_status $request_time $upstream_response_time

日誌記錄:[07/Jun/2018:08:35:33 +0800] 1326 499 - 0.379 -


2.開啓時:如果客戶端端主動關閉請求或者客戶端網絡斷掉,Nginx會等待後端處理完(或者超時),然後記錄後端的返回信息到日誌。所以,如果後端返回200,就記錄200 ;如果後端返回5XX,那麼就記錄5XX。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章