---
title: "HTTP 502 Bad Gateway โ What It Means & How to Fix It"
description: "HTTP 502 Bad Gateway: The server acting as a gateway or proxy received an invalid response from the upstream server. Common causes, fixes and how to monitor it."
url:
https://uptrack.app/http/502
---
# HTTP 502 Bad Gateway
The server acting as a gateway or proxy received an invalid response from the upstream server. The reverse proxy (nginx, Cloudflare, a load balancer) is working, but the backend application server returned something it could not understand.
## What does HTTP 502 mean?
The server acting as a gateway or proxy received an invalid response from the upstream server. The reverse proxy (nginx, Cloudflare, a load balancer) is working, but the backend application server returned something it could not understand.
## Common causes
1. 1
The upstream application server crashed or is not running. The proxy can reach the port but gets a malformed or empty response.
2. 2
The application server returned a response with invalid HTTP headers or a corrupted body that the proxy cannot parse.
3. 3
A firewall, security group, or network issue between the proxy and the upstream server is mangling or dropping packets.
## How to fix it
1. 1
Check if the upstream application server is running: verify the process, check its logs, and confirm it is listening on the expected port.
2. 2
Restart the application server. If it crashed due to an out-of-memory error, check resource usage and increase memory limits.
3. 3
Review the proxy configuration. Ensure proxy\_pass (nginx) or upstream settings point to the correct host and port. Check for protocol mismatches (HTTP vs HTTPS).
## Monitor for HTTP 502 errors
A 502 usually means your app server is down while the proxy layer is still healthy. Uptrack detects this within 30 seconds โ much faster than waiting for user complaints. Pair Uptrack with server resource monitoring for full coverage.
## Catch HTTP errors before your users do
Start free, or choose a plan, for 30-second monitoring and alert confirmation.
[See plans](
https://uptrack.app/pricing)
from $3/mo ยท 30-day money-back guarantee
## Other HTTP status codes
- [HTTP 503 Service Unavailable](
https://uptrack.app/http/503)
- [HTTP 500 Internal Server Error](
https://uptrack.app/http/500)
- [HTTP 504 Gateway Timeout](
https://uptrack.app/http/504)
- [HTTP 520 Web Server Returns Unknown Error](
https://uptrack.app/http/520)
- [HTTP 522 Connection Timed Out](
https://uptrack.app/http/522)
- [HTTP 451 Unavailable For Legal Reasons](
https://uptrack.app/http/451)
- [HTTP 429 Too Many Requests](
https://uptrack.app/http/429)
- [HTTP 422 Unprocessable Entity](
https://uptrack.app/http/422)
- [HTTP 415 Unsupported Media Type](
https://uptrack.app/http/415)
- [HTTP 413 Payload Too Large](
https://uptrack.app/http/413)
- [HTTP 410 Gone](
https://uptrack.app/http/410)
- [HTTP 409 Conflict](
https://uptrack.app/http/409)
- [HTTP 408 Request Timeout](
https://uptrack.app/http/408)
- [HTTP 405 Method Not Allowed](
https://uptrack.app/http/405)
- [HTTP 404 Not Found](
https://uptrack.app/http/404)
- [HTTP 403 Forbidden](
https://uptrack.app/http/403)
- [HTTP 401 Unauthorized](
https://uptrack.app/http/401)
- [HTTP 400 Bad Request](
https://uptrack.app/http/400)
- [HTTP 304 Not Modified](
https://uptrack.app/http/304)
- [HTTP 302 Found](
https://uptrack.app/http/302)
- [HTTP 301 Moved Permanently](
https://uptrack.app/http/301)
- [HTTP 204 No Content](
https://uptrack.app/http/204)
- [HTTP 201 Created](
https://uptrack.app/http/201)
- [HTTP 200 OK](
https://uptrack.app/http/200)