HTTP Status Codes / 5xx HTTP Status Codes / HTTP 502

502 Bad Gateway

This is an educational reference page about HTTP 502 Bad Gateway. The page itself is served as 200 OK so it can be indexed as HTTP documentation.

The server was acting as a gateway or proxy and received an invalid response from the upstream server.

What it means

HTTP 502 means a gateway or proxy received an invalid response from an upstream server.

Common causes

How to fix it

Example response

HTTP/1.1 502 Bad Gateway
Content-Type: text/html

<h1>Bad Gateway</h1>

Developer notes

502 points at communication between servers. It usually is not caused by a malformed client request.

Related comparisons

5xx server error – the server failed to fulfill an apparently valid request


HTTP status code lookup
By Ping Now, a website/API/service uptime monitor
Data from Wikipedia