502 錯誤閘道器
HTTP 502 Bad Gateway 伺服器錯誤響應 狀態碼錶示伺服器充當閘道器或 代理,並且它從上游伺服器收到了無效的響應。
此響應類似於 500 Internal Server Error 響應,因為它是一個通用的“catch-call”用於伺服器錯誤。區別在於它特定於請求鏈中發生錯誤的點。如果源伺服器向閘道器傳送有效的 HTTP 錯誤響應,則應將響應傳遞給客戶端,而不是 502,以使故障原因透明。如果代理或閘道器未從源收到任何 HTTP 響應,它將向客戶端傳送 504 Gateway Timeout。
502 錯誤有很多原因,解決此類問題可能需要伺服器所有者或管理員進行調查。例外情況是客戶端網路錯誤,特別是如果服務對其他訪問者有效,以及如果客戶端使用 VPN 或其他自定義網路設定。在這種情況下,客戶端應檢查網路設定、防火牆設定、代理設定、DNS 配置等。
狀態
http
502 Bad Gateway
示例
502 閘道器錯誤響應
以下請求嘗試獲取網頁,但返回 502 響應。響應主體包含一個描述伺服器狀態的頁面,其中包含指向訪問者支援頁面的連結。
http
GET /highlights HTTP/1.1
Host: example.com
User-Agent: curl/8.6.0
Accept: */*
http
HTTP/1.1 502 Bad Gateway
Content-Type: text/html;
Content-Length: 123
<!doctype html>
<html lang="en">
<head>
<title>502 Bad Gateway</title>
</head>
<body>
<h1>Bad Gateway</h1>
<p>The server was unable to complete your request. Please try again later.</p>
<p>If this problem persists, please <a href="https://example.com/support">contact support</a>.</p>
</body>
</html>
規範
| 規範 |
|---|
| HTTP 語義 # status.502 |