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