Documentation Python quickstart Blog Free tools Enterprise solutions hello@quanticdata.ioLog in

Proxy error codes: which status came from the proxy, which from the site

How to read a proxy error code: an HTTPS request through a proxy gets two statuses, first the proxy's reply to CONNECT (200 Connection established, 407 for a wrong password, or a 5xx when the host cannot be reached) and then the website's own status such as 403, 429 or 500; the card lists which side sent each code.
How to read a proxy error code: an HTTPS request through a proxy gets two statuses, first the proxy's reply to CONNECT (200 Connection established, 407 for a wrong password, or a 5xx when the host cannot be reached) and then the website's own status such as 403, 429 or 500; the card lists which side sent each code.

A proxy error code is a status in the proxy's own reply, and it is easy to confuse with the website's. For an HTTPS page there are two: the proxy answers your CONNECT first (200, 407 for bad credentials, a 5xx when it cannot reach the host), then the site answers your request (403, 404, 429, 500). Read which one failed before you change anything.

Everything below comes from requests we sent on 20 November 2026 with curl.exe 8.22.0 and Python Requests on Windows 11, through three QuanticData networks: Residential Basic, Residential Premium and Mobile. Ten cases per network, 30 in all, against httpbin.org, a public test service that returns whatever status you ask for. Exit IPs are masked; USER and PASS stand for the credentials.

Two status codes in one HTTPS request

When you fetch an https:// URL through an HTTP proxy, your client first asks the proxy to open a tunnel with CONNECT host:443. The proxy replies with a status line of its own. Only after a 200 does TLS start, end to end between you and the site, and the site's status comes back through the tunnel; the proxy cannot read it or change it. curl prints both if you ask for them:

curl.exe -s -o NUL -w "%{http_connect} %{http_code}\n" -x http://residentialpremium.quanticdata.io:8080 -U "USER:PASS" https://httpbin.org/status/429
200 429

curl.exe -s -o NUL -w "%{http_connect} %{http_code}\n" -x http://residentialpremium.quanticdata.io:8080 -U "USER:wrongpass" https://httpbin.org/status/200
407 000

The first line says the proxy opened the tunnel (200) and the site refused the request (429). The second says the proxy refused us (407), so the site was never reached and curl reports 000 for it. Most "proxy errors" people report are the first kind: a code from the website that travelled through a proxy that worked.

What we got, case by case

CaseCONNECT reply (proxy)Page status (site)Who sent the error
Working request200 Connection established200Nobody
Wrong password407 Proxy Authentication Requirednone (000)The proxy
Host that does not existA 5xx on all three networksnone (000)The proxy
Site returns 403200403The site
Site returns 404200404The site
Site returns 429200429The site
Site returns 500, 502 or 503200500, 502 or 503The site
Plain http:// URL, site returns 500no CONNECT500The site, relayed by the proxy

The site's codes were the same on all three networks: the proxy passed them on untouched. The proxy's own codes appeared only when the problem was the login or the destination host.

Codes the proxy sends

407 Proxy Authentication Required

The gateway did not accept the username and password, or got none. All three networks answered a wrong password in 138 to 252 milliseconds with a Proxy-Authenticate: Basic header, so a 407 is fast and certain: no request reached the site and no exit IP was used. Python Requests turns it into an exception instead of a status:

requests.exceptions.ProxyError: HTTPSConnectionPool(host='httpbin.org', port=443): Max retries exceeded with url: /ip
(Caused by ProxyError('Unable to connect to proxy', OSError('Tunnel connection failed: 407 Proxy Authentication Required')))

Check the username first: on our networks the country, session and lifetime live inside it, and one wrong character is a different, unknown user. The full walk-through is in how to fix 407 Proxy Authentication Required, and the exception itself in requests.exceptions.ProxyError.

5xx on CONNECT: the gateway could not reach the host

A 5xx in the CONNECT reply means the proxy accepted you but could not open a connection to the host you named. For a hostname that does not exist, all three networks answered the CONNECT with a 5xx and never opened the tunnel. Under the HTTP standard the usual codes are 502 Bad Gateway (the next server gave an invalid answer), 503 Service Unavailable (the destination cannot be served right now) and 504 Gateway Timeout (it did not answer in time). Whichever one you get, the cure is on your side: check the spelling of the host, whether it resolves from a normal browser, and the port. Retrying the same host on a new IP does not fix a name that does not exist.

502 and 504 from a proxy

By the HTTP standard, a 502 Bad Gateway from a proxy means it got an invalid answer from the next server, and a 504 Gateway Timeout means that server did not answer in time. In our tests every 502 came from the site, inside the tunnel, with a 200 on CONNECT. That is the first thing to check when you see one: print %{http_connect} and you know which side it was.

Codes the website sends through the proxy

CodeWhat it means for a scraperWhat to do
301, 302, 307The page movedFollow the Location header; store the new URL for a 301
304 Not ModifiedYour copy is currentReuse it; on books.toscrape.com a repeat request with If-None-Match got 304 and 0 bytes instead of 51,294
400 Bad RequestThe request itself is malformedCheck the URL encoding, the body and the headers; a new IP will not change it
401 UnauthorizedThe site wants its own loginNot a proxy problem. Pages behind a login are outside what a proxy is for
403 ForbiddenThe site refused this clientRead the block page; see web scraping 403 Forbidden
404 Not FoundNo such pageDrop the URL; retrying is wasted traffic
429 Too Many RequestsToo fast for the site's limitSlow down and honour Retry-After; see 429 Too Many Requests when scraping
500 Internal Server ErrorThe site failed while answeringRetry a few times with backoff, then skip
502, 503, 504The site, or a server in front of it, is overloaded or downRetry with backoff and honour Retry-After on 503

Rate limits sometimes arrive with a code of their own instead of 429: Cloudflare shows Cloudflare error 1015, for example. The logic is the same: slow down.

Plain http:// URLs: one status, two possible senders

For an http:// URL there is no CONNECT. The proxy forwards the request and relays the site's reply, so you see one status line: our 500 from httpbin.org arrived as a plain HTTP/1.1 500 Internal Server Error. To tell a site error from a proxy error here, look at the body and the headers: a site's error page carries the site's own headers and HTML. Most sites now redirect to https anyway, and then you are back to two codes.

Retry the right codes, not every code

A scraper should retry 429, 500, 502, 503 and 504, wait longer each time, and give up after a few tries. It should not retry 400, 401, 403 or 404: the answer will be the same. In Python Requests this is a few lines with urllib3's Retry:

import requests
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry

retry = Retry(total=3, backoff_factor=1, status_forcelist=[429, 500, 502, 503, 504],
              allowed_methods=["GET", "HEAD"], respect_retry_after_header=True)
s = requests.Session()
s.mount("https://", HTTPAdapter(max_retries=retry))
proxy = "http://USER:PASS@residentialpremium.quanticdata.io:8080"
s.proxies = {"http": proxy, "https": proxy}

s.get("https://httpbin.org/status/503")   # RetryError after 8.3 s: too many 503 error responses
s.get("https://httpbin.org/status/404")   # 404 at once (0.3 s), not retried

Three retries with a backoff factor of 1 spent 8.3 seconds on the 503 before giving up, and the 404 came back in 0.3 seconds because it was not in the list. Keep the 407 out of the list too: a wrong password stays wrong.

When the error is the site saying no

A 403 or a run of 429s on a page that loads in your own browser usually means the site does not like the client or the pace, not that the proxy is broken. Slow down first. For public pages that need a real browser, see the Web Unlocker. For the plain network, residential proxies and mobile proxies give you home and carrier IPs in the country you pick, and the proxy not working checklist walks through the rest layer by layer. For the curl options used above, see how to use a proxy with curl.

None of this changes what a site allows. A proxy is for public pages you are permitted to fetch: respect robots.txt, the site's terms and its rate limits, and leave pages behind a login alone.

Sources & further reading

FAQ

Quick answers on proxy error codes.

Something else? Ask us

What is a proxy error?

An error in the proxy's own reply, before the website is involved: 407 when the proxy refuses your credentials, or a 5xx on CONNECT when it cannot reach the host. A 403, 404, 429 or 500 that arrives after a 200 on CONNECT is the website's answer, passed through a proxy that worked.

How do I know whether the proxy or the website sent the error?

Print both statuses. With curl, -w "%{http_connect} %{http_code}" shows the proxy's reply to CONNECT and then the site's status. In our tests a wrong password gave 407 000 and a rate-limited page gave 200 429.

What does proxy error 407 mean?

Proxy Authentication Required: the gateway did not accept the username and password, or got none. No request reached the site. Check the username character by character; on our networks it also carries the country and the session.

What is proxy error 502?

By the HTTP standard, a 502 Bad Gateway from a proxy means it got an invalid answer from the next server. In our tests every 502 came from the website itself, inside the tunnel, after a 200 on CONNECT. Check %{http_connect} to see which side sent yours, then retry with backoff.

What does 503 mean on a proxy?

On the CONNECT reply, it means the proxy could not reach the host you asked for: in our tests a hostname that does not exist got a 5xx on all three networks. As a page status after a 200 on CONNECT, it is the site saying it is overloaded; retry later and honour Retry-After.

Should a scraper retry a 500 Internal Server Error?

Yes, a few times with a growing wait, because the site may recover. Retry 429, 500, 502, 503 and 504; do not retry 400, 401, 403, 404 or 407, which will give the same answer.

Know which side failed, then fix it

Residential and mobile proxies in the country you pick. Print both status codes and you see whether the proxy or the site answered.

Related reading