502 Bad Gateway Error Through a Proxy
An intermediate server did not get a proper response from the next hop. This is usually solved by retrying or changing the address.
What the error means
The 502 code means that an intermediary server passed the request on and got an error or nothing at all. The intermediary may be our gateway, or it may be a server in front of the site itself.
In Prokso the gateway response looks like 502 NO_HOST_CONNECTION: the proxy could not connect to the site. If there is no name after the code, the 502 was returned by the site or its content delivery network.
Causes
- The site is down or overloaded. It does not answer anyone — neither through the proxy nor directly.
- The site rejected the connection from this address. The same site may answer from another address or another country.
- An error in the site address. A typo in the domain, a subdomain that does not exist, a wrong port.
- The protocol is mixed up. An HTTP request was sent to the SOCKS5 port or the other way round.
- A particular exit address is offline. In residential and mobile networks a device can drop off the network at any moment.
How to fix it
- Retry the request: with rotation, the next one will go through a different address.
- Check the site address and open it without the proxy — does it work at all?
- Check the port and protocol: 823 is HTTP, 824 is SOCKS5.
- Change the country or remove the city and ISP targeting.
- On a sticky IP, change the session: take another port from the 10000–20000 range.
- Add a retry on 502 with a short pause to your program — two or three attempts are enough.
How to check that it works
Test the line in the proxy checker. If the proxy responds and 502 remains on one site only, the cause is on that site's side.
FAQ
How is 502 different from 503 and 504?
502 — the intermediary got a bad response. 503 — the service is temporarily unavailable or there are no free addresses. 504 — the intermediary did not get a response within the allotted time.
502 shows up from time to time. Is that normal?
Rare single 502 errors are expected for residential and mobile addresses: devices go offline. Retrying the request solves it. If the error repeats in a row for more than a few minutes, contact support.
Where can I see which errors the plan had?
In the dashboard, in the plan's request log: it shows the error code and the time.
Residential $1.59, mobile $2.50, datacenter $0.80 per GB
Sign up in a minute, get access right after payment.