tool::http-status-detail
502 Bad Gateway
The gateway received an invalid response from an upstream server.
ステータスコード
502
名前
Bad Gateway
カテゴリ
5xx詳細説明
HTTP 502 Bad Gatewayは、ゲートウェイまたはプロキシサーバーがアップストリームサーバーから無効なレスポンスを受け取ったことを示します。一般的にリバースプロキシ(Nginx、AWS ALBなど)の背後にあるアプリケーションサーバーがダウンしているか、異常なレスポンスを返している場合に発生します。CDNを使用している場合、オリジンサーバーの問題でも発生することがあります。
主な原因
- ▸アップストリームのアプリケーションサーバーがダウンしている場合
- ▸アップストリームサーバーのレスポンスが不正な形式の場合
- ▸ロードバランサー配下のすべてのサーバーが異常な場合
- ▸プロキシとアップストリーム間のネットワーク問題
- ▸アップストリームサーバーが過負荷で接続を拒否している場合
解決方法
- 1.アップストリームサーバーのプロセスが実行中か確認してください(systemctl status、docker ps)
- 2.プロキシ設定でupstreamのアドレスとポートが正しいか確認してください
- 3.アップストリームサーバーのログを確認してください
- 4.サーバー間のネットワーク接続をテストしてください(curl、telnet)
- 5.プロキシのtimeout設定を延長してみてください(proxy_read_timeoutなど)
関連HTTPヘッダー
Retry-AfterServerレスポンス例
HTTP/1.1 502 Bad Gateway Server: nginx/1.24.0 Content-Type: text/html <html><body><h1>502 Bad Gateway</h1></body></html>
関連ステータスコード
500Internal Server ErrorThe server encountered an unexpected condition.→501Not ImplementedThe server does not support the requested functionality.→503Service UnavailableThe server is temporarily unable to handle the request.→504Gateway TimeoutThe gateway did not receive a timely response from an upstream server.→505HTTP Version Not SupportedThe HTTP version used in the request is not supported.→
ad · 300×250
// related tools