New videos every week — proxies, VPNs & antidetect browsers, explained.

Subscribe
GuidesNov 23, 202621 min read

Proxy Error Codes Explained: 407, 502, 503 and Connection Failures

Decode proxy error codes like 407, 502, 503, 504, ERR_TUNNEL_CONNECTION_FAILED, SOCKS5 replies and curl exits, and find out which hop failed.

Table of contents

A proxy error is frustrating because it hides the most useful fact: who actually said no. A 407 comes from your proxy, a 403 usually comes from the website, and a 502 means the proxy tried to reach the website and got something it couldn't use. Once you know which hop produced the error, the fix is usually obvious. This guide decodes the proxy error codes you'll actually meet (HTTP status codes, Chrome's ERR_PROXY_CONNECTION_FAILED and ERR_TUNNEL_CONNECTION_FAILED, SOCKS5 reply codes and curl exit codes), shows where to look first for each one, and ends with a diagnosis flow and a full reference table.

How to read a proxy error: three places a request can fail

Every proxied request passes through three stages, and each stage fails in its own way. If you can tell which stage failed, you're most of the way to a fix.

  1. Reaching the proxy. Your client opens a TCP connection to the proxy host and port. If the hostname doesn't resolve, the port is closed or a firewall drops the packets, you get a connection-level error and no HTTP status code at all. In curl that's exit code 5, 7 or 28. In Chrome it's usually ERR_PROXY_CONNECTION_FAILED.
  2. Getting past the proxy. The proxy checks who you are and whether it will carry your request. For an HTTP proxy this is where 407 Proxy Authentication Required lives. For SOCKS5 it's the method negotiation and the username/password sub-negotiation. A wrong password, an unauthorised IP or an expired plan all fail here.
  3. Reaching the target. The proxy connects onward to the website. If that upstream hop fails, the proxy reports it with a 502, 503 or 504, or with a SOCKS5 reply code such as "host unreachable". If the hop works but the website doesn't like the request, the website itself answers with 403, 429 or a challenge page.

The same three-stage model also explains why some errors carry a status code and others don't. Stage 1 failures never get far enough for anyone to send an HTTP response. Stage 2 and stage 3 failures usually do, but with HTTPS the answer can come from two different places, which is the subject of the next section.

Who returned the error: proxy or target?

This is the single most useful question in proxy troubleshooting. A status code doesn't tell you who sent it. A 403 from a corporate proxy that blocks a destination looks the same as a 403 from a website that blocks your IP. You have to work out which hop it came from.

HTTPS targets: the CONNECT response is always the proxy's

When you fetch an https:// URL through an HTTP proxy, the client first sends a CONNECT host:443 request. RFC 9110 describes CONNECT as asking the recipient to establish a tunnel to the destination and then blindly forward data in both directions. Any status code you receive in reply to that CONNECT was written by the proxy, because the website hasn't been contacted yet or the proxy is reporting that it couldn't reach it. Only after a 2xx reply does TLS start, and only then can the target send its own status codes, encrypted inside the tunnel.

That gives you a reliable test. If curl reports CONNECT tunnel failed, response 407 (or response 403, or response 502), the proxy produced that code. If the CONNECT succeeds and you get a 403 or 429 on the final response, the target produced it.

Plain HTTP targets: look at the headers

With an http:// URL there's no tunnel. The proxy forwards your request and relays the response, so a proxy-generated error and a target-generated error arrive on the same channel. Clues that help:

  • A 407 always comes from a proxy, and RFC 9110 says the proxy must include a Proxy-Authenticate header with it.
  • Error pages with the proxy software's or the provider's branding, or a Server header that names proxy software, point to the proxy.
  • Pages that look like the target site, bot-check pages or anti-bot vendor headers point to the target.
  • If switching the URL to https:// moves the error into the CONNECT phase, it was the proxy. If it stays on the final response, it was the target.
Diagram: client to proxy to target, showing 407 at the proxy hop, 502 and 504 on the proxy-to-target hop, and 403 and 429 from the target
Each hop has its own errors: 407 is the proxy refusing you, 502 and 504 are the proxy failing to reach the target, and 403 and 429 usually come from the target.

The one-command check

Run curl with -w '%{http_connect} %{http_code}'. The first number is the proxy's answer to CONNECT and the second is the final response from the target. A 407 000 is a proxy problem. A 200 403 means the tunnel worked and the website refused you.

# First number = proxy's CONNECT reply, second = target's final status
curl -s -o /dev/null \
  -w 'connect=%{http_connect} final=%{http_code}\n' \
  -x http://USER:PASS@proxy.example.net:8080 \
  https://example.com/

# Examples of what you might see:
# connect=407 final=000   -> proxy rejected your credentials
# connect=502 final=000   -> proxy could not reach the target
# connect=200 final=403   -> tunnel fine, target blocked the request
# connect=200 final=429   -> tunnel fine, target is rate limiting you

407 Proxy Authentication Required: a credential problem

RFC 9110 defines 407 as similar to 401, except that the client needs to authenticate itself to use a proxy. The proxy must send a Proxy-Authenticate header with at least one challenge, such as Basic realm="...", and the client may retry with a Proxy-Authorization header. In practice a 407 means one of these things:

  • No credentials were sent. The client wasn't told about the username and password, or a library dropped them. Some tools only send proxy credentials after a challenge, others send them up front.
  • Wrong credentials. A typo, an old password after a reset, or the dashboard login used where a separate proxy password was required.
  • Special characters were mangled. If the password contains @, :, # or % and you put it inside a proxy URL, it must be percent-encoded. Otherwise the client splits the URL in the wrong place and sends half a password.
  • Unsupported auth scheme. If the proxy only offers a scheme your client can't do, the client can't answer the challenge. Chrome has a dedicated error for this, ERR_PROXY_AUTH_UNSUPPORTED.
  • The account or IP allowlist is the issue. Many providers authenticate by username/password or by allowlisted source IP. If you rely on IP allowlisting and your own IP changed, you can get a 407 even though nothing in your code changed.

Here is what a 407 on an HTTPS request looks like in curl -v. The key lines are the CONNECT, the Proxy-Authorization header curl sent, and the 407 that came back.

$ curl -v -x http://user:wrongpass@proxy.example.net:8080 https://example.com/
* Proxy auth using Basic with user 'user'
* Establish HTTP proxy tunnel to example.com:443
> CONNECT example.com:443 HTTP/1.1
> Host: example.com:443
> Proxy-Authorization: Basic dXNlcjp3cm9uZ3Bhc3M=
>
< HTTP/1.1 407 Proxy Authentication Required
< Proxy-Authenticate: Basic realm="proxy"
* CONNECT tunnel failed, response 407
curl: (56) CONNECT tunnel failed, response 407

If there's no Proxy-Authorization line at all, curl never had credentials, so look at your config. If the line is there and you still get 407, the credentials themselves are wrong. Basic auth is only base64-encoded, so you can decode the header to check exactly what was sent. Don't paste real headers into shared logs, though, because anyone who sees one can decode it too.

Don't retry a 407 in a loop

A 407 is not a temporary failure. Retrying with the same bad credentials won't help, and repeated failed logins may get your IP or account locked by some providers. Fix the credentials, then retry once.

502, 503 and 504: the proxy couldn't finish the job

These three are gateway errors. When a proxy sends them, it's saying it accepted your request but couldn't complete the trip to the target. RFC 9110 defines them as follows:

  • 502 Bad Gateway: the server, acting as a gateway or proxy, received an invalid response from an inbound server it accessed while trying to fulfil the request.
  • 503 Service Unavailable: the server is currently unable to handle the request because of temporary overload or maintenance, which will likely be fixed after some delay. It may include a Retry-After header.
  • 504 Gateway Timeout: the server, acting as a gateway or proxy, didn't receive a timely response from an upstream server it needed to complete the request.

What they usually mean with proxies

With a rotating residential or mobile pool, a 502 or 504 often means the specific exit node assigned to you was slow, offline or couldn't reach the target. Those exits are real devices on consumer connections, and some of them drop off at any moment. With a datacenter proxy, the cause is more often the target refusing or timing out, or a DNS failure on the proxy's side. Proxy software can also use 502 for an upstream DNS failure or a refused connection. The exact choice of code varies by implementation, so treat 502 and 504 as "upstream hop failed" rather than reading too much into which one you got.

A 503 is trickier because both sides use it. A proxy may send 503 when it's overloaded or when your plan has hit a concurrency limit. A website may send 503 during maintenance, or as part of a bot challenge. Use the CONNECT test from the earlier section to tell the two apart.

First fixes

  • Retry once with a new exit IP. On rotating proxies that often means just sending the request again. With sticky sessions, change the session ID. Our guide to how rotating proxies work explains how session and rotation settings decide which exit you get.
  • If Retry-After is present, honour it. RFC 9110 allows it to be either a number of seconds or an HTTP date.
  • If every exit returns 502 for one site but other sites work, the target is the problem, or the provider may block that destination.
  • If every site returns 5xx, check the provider's status page and your plan limits before touching your code.

403 and 429: when the target is pushing back

RFC 9110 defines 403 Forbidden as the server understanding the request but refusing to fulfil it. RFC 6585 defines 429 Too Many Requests as the user having sent too many requests in a given amount of time, and says the response may include Retry-After. RFC 6585 deliberately doesn't say how a server identifies the user or counts requests. It can be by IP, account, cookie or anything else, and that matters for proxies, because rotating your IP doesn't help if the site counts by session cookie or login.

When these codes arrive after a successful CONNECT, the proxy did its job. The website decided it didn't want the request. Common reasons:

  • The exit IP is on a datacenter range or a reputation list the site blocks.
  • Your request rate from one IP, session or account crossed a threshold.
  • Your headers, TLS fingerprint or missing cookies look automated.
  • The content is geo-restricted and the exit is in the wrong country.

We go deeper into these signals in why proxies get blocked. The short version: slow down, spread requests across more IPs or sessions, send realistic headers, and choose an exit location that matches the content.

A 403 can also come from the proxy. Some proxies refuse certain destinations or ports, and corporate proxies enforce URL policies. If curl prints CONNECT tunnel failed, response 403, it's the proxy refusing the destination, not the website. Contact the provider or your network admin instead of changing user agents.

Browser errors: ERR_PROXY_CONNECTION_FAILED, ERR_TUNNEL_CONNECTION_FAILED and friends

Chrome, Edge and other Chromium-based browsers don't show raw proxy status codes for HTTPS sites. They show a net error instead. These come from Chromium's net_error_list.h, and the source comments explain what each one covers:

  • ERR_PROXY_CONNECTION_FAILED (-130): couldn't create a connection to the proxy server, either because resolving its name failed or connecting a socket to it failed. The source comment notes that this does not include failures during the HTTP CONNECT itself. In other words, the browser never reached the proxy. Check the proxy host and port, whether the proxy is running, and whether a firewall or VPN is in the way.
  • ERR_TUNNEL_CONNECTION_FAILED (-111): a tunnel connection through the proxy couldn't be established. The browser reached the proxy, but the CONNECT step didn't succeed. Chromium uses this for general errors connecting to the proxy and when handling the proxy's response. Typical causes are the proxy refusing the destination, an upstream failure, or a protocol mismatch such as pointing an HTTP proxy setting at a SOCKS-only port.
  • ERR_PROXY_AUTH_UNSUPPORTED (-115): the proxy asked for authentication with a method the browser doesn't support.
  • ERR_PROXY_CERTIFICATE_INVALID (-136): the certificate presented by an HTTPS proxy, meaning a proxy you connect to over TLS, was invalid.
  • ERR_SOCKS_CONNECTION_FAILED (-120) and ERR_SOCKS_CONNECTION_HOST_UNREACHABLE (-121): the SOCKS equivalents. The first is a failure to establish the connection through the SOCKS proxy for a target host. The second means the SOCKS server couldn't reach the target because the host is unreachable.
  • ERR_MANDATORY_PROXY_CONFIGURATION_FAILED (-131): a mandatory proxy configuration couldn't be used. Chromium currently uses this when a mandatory PAC script couldn't be fetched, parsed or run.
  • ERR_NO_SUPPORTED_PROXIES (-336): none of the proxies in the configured list are supported.

Browsers also cache proxy credentials and settings, which can hide what changed. If you've just updated a password, restart the browser or use a fresh profile before you decide the new credentials are wrong. In Chrome and Edge on Windows and macOS, the proxy settings usually come from the operating system, so check the OS proxy settings too.

CONNECT tunnel failures in curl

curl is the fastest way to see exactly what a proxy says, because -v prints the CONNECT request and the proxy's reply line by line. The message wording depends on your curl version, which trips people up when they search for it:

  • curl 7.86.0 and older print Received HTTP code 407 from proxy after CONNECT.
  • curl 7.87.0 and newer print CONNECT tunnel failed, response 407.

Both mean the same thing: the proxy answered the CONNECT with a non-2xx status, and curl exits with code 56 (CURLE_RECV_ERROR). The number at the end is the proxy's status code, so a response 502 or response 403 is read the same way as the HTTP codes above. We checked this against curl's source for both version ranges and reproduced the newer message with curl 8.14.1 against a local test proxy.

# See the CONNECT exchange and only the proxy-related lines
curl -sv -o /dev/null -x http://USER:PASS@proxy.example.net:8080 \
  https://example.com/ 2>&1 | grep -E '^(> CONNECT|< HTTP|\* CONNECT|curl:)'

# Same request with credentials passed separately (avoids URL-encoding issues)
curl -v -x http://proxy.example.net:8080 --proxy-user 'USER:p@ss:word' \
  https://example.com/

If you see a 2xx reply to CONNECT followed by a TLS error, the tunnel worked and the problem is the TLS handshake with the target, or an intercepting proxy presenting its own certificate. That shows up as curl exit 35 (TLS handshake) or 60 (certificate not OK). For a fuller tour of curl's proxy flags, see how to use proxies with curl.

SOCKS5 reply codes and authentication failures

SOCKS5 doesn't use HTTP status codes. It has its own binary handshake, defined in RFC 1928, with username/password authentication added by RFC 1929. Failures happen in three places:

1. Method negotiation

The client lists the authentication methods it supports. RFC 1928 defines X'00' as no authentication required, X'01' as GSSAPI and X'02' as username/password. If the server replies X'FF' (no acceptable methods), it wants a method you didn't offer, and the client must close the connection. In practice this usually means the proxy requires a username and password and you didn't supply any. curl reports it as No authentication method was acceptable.

2. Username/password sub-negotiation

RFC 1929 says a status of X'00' means success, and for any other value the server must close the connection. That's the SOCKS equivalent of a 407. curl reports it as User was rejected by the SOCKS5 server. The same causes apply: wrong credentials, an expired account, or the wrong port. RFC 1929 also warns that this method sends the password in cleartext, so avoid it on networks where traffic can be sniffed.

3. The CONNECT reply (REP field)

Once authenticated, the client asks the proxy to connect to the target, and the proxy answers with a reply code. RFC 1928 defines these values:

REPMeaning (RFC 1928)What it usually tells you
X'00'succeededTunnel is up. Any error after this comes from the target or TLS.
X'01'general SOCKS server failureSomething broke inside the proxy. Retry or swap the exit.
X'02'connection not allowed by rulesetThe proxy's policy forbids this destination or port.
X'03'Network unreachableThe exit has no route to the target network.
X'04'Host unreachableThe target host couldn't be reached, often because DNS failed or the host is down.
X'05'Connection refusedThe target refused the connection. Check the port.
X'06'TTL expiredRouting problem between the exit and the target.
X'07'Command not supportedThe proxy doesn't support the command, for example BIND or UDP ASSOCIATE.
X'08'Address type not supportedFor example, you sent a hostname or IPv6 address the proxy can't handle.

curl shows the reply code in brackets at the end of its message, for example cannot complete SOCKS5 connection to example.com. (5) for a refused connection, and exits with code 97 (CURLE_PROXY). One SOCKS-specific gotcha: with socks5:// curl resolves the hostname locally and sends the proxy an IP address, while socks5h:// lets the proxy resolve it. If a target only resolves correctly from the exit's location, or you want to avoid local DNS leaks, use socks5h. Our SOCKS5 vs HTTP proxies comparison covers the protocol differences in more detail.

# Let the proxy resolve DNS (note the h) and watch the handshake
curl -v -x socks5h://USER:PASS@proxy.example.net:1080 https://example.com/

# Typical failure messages from curl 8.x:
# curl: (97) No authentication method was acceptable.
# curl: (97) User was rejected by the SOCKS5 server (1 1).
# curl: (97) cannot complete SOCKS5 connection to example.com. (5)

curl exit codes that point at the proxy

When curl fails before it gets any HTTP response, the exit code is your main clue. The meanings below come from curl's official libcurl-errors documentation, and each code tells you which stage failed.

  • Exit 5, CURLE_COULDNT_RESOLVE_PROXY: the proxy hostname couldn't be resolved. Check for a typo in the proxy host, or a DNS problem on your machine. This is different from exit 6, which means the target host couldn't be resolved.
  • Exit 7, CURLE_COULDNT_CONNECT: failed to connect to the host or proxy. With a proxy set, that usually means the proxy's port is closed, the proxy is down or a firewall is rejecting you. Check the port number first. HTTP and SOCKS ports are often different.
  • Exit 28, CURLE_OPERATION_TIMEDOUT: a timeout was reached. If it fires during connect (Connection timed out after ... milliseconds), packets to the proxy are being dropped silently, which is typical of firewalls, an IP allowlist, or a wrong host. If it fires later, the exit or the target is slow.
  • Exit 56, CURLE_RECV_ERROR: failure receiving network data. With proxies, this is the exit code for a non-2xx reply to CONNECT, so read the status number in the message. It can also mean a connection was cut mid-transfer, which often happens when an unstable residential exit drops.
  • Exit 97, CURLE_PROXY: proxy handshake error. curl uses it for SOCKS failures, and libcurl exposes the detailed reason through CURLINFO_PROXY_ERROR, with values such as CURLPX_REPLY_CONNECTION_REFUSED or CURLPX_USER_REJECTED.

A useful habit: in scripts, always log curl's exit code next to %{http_connect} and %{http_code}. Those three values together usually identify the failing hop without any extra debugging.

A step-by-step diagnosis flow

When a proxied request fails, work through these checks in order. Each one rules out a whole stage, so you rarely need all of them.

  1. Is there a status code at all? If not (curl exit 5, 7 or 28 at connect time, or ERR_PROXY_CONNECTION_FAILED), you never reached the proxy. Verify the host, port and protocol scheme, then test from another network to rule out a local firewall.
  2. Is it a 407, or a SOCKS auth rejection? Fix authentication. Re-copy the credentials, percent-encode special characters or pass them with --proxy-user, confirm your IP is allowlisted if you use IP auth, and check the plan hasn't expired.
  3. Did the CONNECT fail with a 5xx, or did SOCKS return an X'01'–X'06' reply? The proxy couldn't reach the target through this exit. Swap the exit IP or session and retry once. If every exit fails for one target, check the target's port and whether the provider blocks it.
  4. Did CONNECT succeed but the final response is 403 or 429? The target is pushing back. Slow down, honour Retry-After, spread load across more IPs or sessions, and make requests look like a real client.
  5. Did CONNECT succeed but TLS fail? Look at certificates. An intercepting proxy needs its CA trusted, and the --proxy-insecure or --insecure flags are for testing only, never production.
  6. Still unclear? Compare a request without the proxy with one through it. If the direct request also fails, the problem is the target or your client, not the proxy.
Flowchart: check the status code, fix authentication on 407, swap the exit IP on 5xx, slow down on 403 or 429
Start from the status code: 407 means fix authentication, 5xx means swap the exit, and 403 or 429 means slow down and look less automated.

For a repeatable way to run these checks before a proxy goes into production (exit IP, location, latency and leaks), use our checklist on how to test a proxy.

Credential problem, dead exit or target block?

Credential problems are consistent: every request fails with 407 or a SOCKS auth rejection, whatever the target. Dead exits are random: some requests fail with 502, 504 or a timeout, then work on the next IP. Target blocks are site-specific: other sites work through the same proxy, but one site returns 403 or 429 after a successful CONNECT.

Proxy error codes reference table

Use this table as a quick lookup. "Who returned it" is the usual source. Where a code can come from either side, the CONNECT test tells you which one it was.

Code / messageWho returned itLikely causeFirst fix
407 Proxy Authentication RequiredProxyMissing or wrong credentials, mangled special characters, IP not allowlisted, expired planRe-enter credentials, percent-encode or use --proxy-user, check allowlist and plan
403 Forbidden on CONNECTProxyProxy policy blocks the destination or portCheck provider or corporate rules for that domain or port
403 Forbidden after tunnelTargetIP reputation, bot detection, geo-restrictionChange IP type or location, send realistic headers, lower request rate
429 Too Many RequestsUsually target (some proxies also enforce limits)Rate limit per IP, session, account or cookieHonour Retry-After, slow down, spread load across IPs and sessions
502 Bad GatewayProxy (about its upstream)Invalid upstream response, exit node failure, upstream DNS or refused connectionRetry once on a new exit, test the target directly
503 Service UnavailableEitherProxy overload or concurrency cap, or target maintenance or challengeCheck where it came from, honour Retry-After, reduce concurrency
504 Gateway TimeoutProxy (about its upstream)Slow or offline exit, slow targetSwap exit, raise timeouts modestly, try another location
ERR_PROXY_CONNECTION_FAILEDBrowser (couldn't reach proxy)Wrong host or port, proxy down, DNS or firewallVerify proxy address, port and that it's running
ERR_TUNNEL_CONNECTION_FAILEDBrowser (CONNECT failed)Proxy refused the tunnel, upstream failure, protocol mismatchTest with curl -v to see the proxy's actual reply
ERR_PROXY_AUTH_UNSUPPORTEDBrowserProxy offers an auth scheme the browser can't useSwitch to a supported scheme or IP allowlisting
curl (56) CONNECT tunnel failed, response N / Received HTTP code N from proxy after CONNECTProxyProxy answered CONNECT with status NRead N with this table: 407 auth, 403 policy, 5xx upstream
curl exit 5Your clientProxy hostname doesn't resolveFix the proxy host spelling, check local DNS
curl exit 7Your clientCouldn't connect to proxy: closed port, proxy down, firewallConfirm the port and protocol (HTTP vs SOCKS)
curl exit 28Your clientTimeout: packets dropped or very slow hopCheck firewall or allowlist, then exit and target speed
curl exit 97Proxy (SOCKS handshake)SOCKS auth or connect failureRead the message and the REP number in brackets
SOCKS5 X'FF' method replyProxyNo acceptable auth method, usually credentials not suppliedAdd username and password to the proxy URL
SOCKS5 auth status not X'00'ProxyUsername/password rejectedFix credentials, same as a 407
SOCKS5 REP X'02'ProxyRuleset forbids the destinationCheck provider restrictions on that target or port
SOCKS5 REP X'03' / X'04' / X'06'Proxy (about its upstream)Network or host unreachable, TTL expiredSwap exit, use socks5h, verify the hostname
SOCKS5 REP X'05'Target (relayed by proxy)Connection refused by targetCheck the target port and service

Preventing repeat proxy errors in your code

Most of the pain with proxy errors comes from treating them all the same. A retry loop that hammers through 407s wastes time, while one that gives up on the first 502 throws away requests that would have worked on the next exit. Build your error handling around the three categories:

  • Do not retry: 407, SOCKS authentication rejections and exit 5. These are configuration problems, so log them and alert.
  • Retry on a new exit: 502, 504, SOCKS REP X'01'–X'06', exit 56 mid-transfer, and connect timeouts on rotating pools. Cap retries and use a new session or IP each time.
  • Back off: 429 and 503 with Retry-After, and repeated 403s from the same site. Waiting and spreading load work better than rotating faster.

Whatever language or library you use, record the stage that failed along with the code. Proxy errors are easier to fix once you know which hop produced each one.

Frequently asked questions

407 Proxy Authentication Required means the proxy itself wants you to authenticate before it will carry the request. The usual causes are missing or wrong credentials, special characters in the password that weren't percent-encoded, or an IP allowlist that no longer includes your address. Fix the credentials rather than retrying, because the same request will keep failing.

This error means Chrome reached the proxy but the CONNECT tunnel to the website could not be established. Check that the proxy type matches the port (HTTP vs SOCKS), that your credentials are correct, and that the proxy allows the destination. Running the same request with curl -v shows the proxy's actual reply and usually points to the cause.

ERR_PROXY_CONNECTION_FAILED means the browser could not connect to the proxy server at all, because of a wrong host or port, DNS failure, firewall or a proxy that is down. ERR_TUNNEL_CONNECTION_FAILED means the browser did reach the proxy, but the tunnel through it to the website failed. The first is a connection problem and the second is a proxy or upstream problem.

A 502 is sent by the proxy, but it describes a problem on the proxy-to-website hop: the proxy got an invalid response from, or could not properly reach, the upstream server. On rotating pools it often means the assigned exit node failed. Retry once on a new exit, and if every exit fails for the same site, test the site directly.

Usually the website is blocking the proxy's exit IP, for example because it is a datacenter range, has a poor reputation, or is in the wrong country for the content. If curl shows the 403 as the response to CONNECT, the proxy is refusing the destination instead. Checking which hop returned the 403 tells you whether to change IPs or contact the provider.

Exit code 56 with CONNECT tunnel failed, response N means the proxy answered curl's CONNECT request with status N instead of a success code. Older curl versions print the same failure as Received HTTP code N from proxy after CONNECT. Read N like a normal status code: 407 is authentication, 403 is proxy policy, and 5xx means the proxy couldn't reach the target.

A 429 means you have been rate limited, usually by the website. Slow down, honour any Retry-After header, and spread requests across more IPs or sessions. Remember that sites may count requests by cookie or account as well as by IP, so rotating IPs alone may not be enough.

SOCKS5 uses reply codes instead of HTTP status codes. Under RFC 1928, X'01' is a general server failure, X'02' means the ruleset forbids the connection, X'03' and X'04' mean the network or host is unreachable, X'05' means the target refused the connection, and X'07' and X'08' mean an unsupported command or address type. A failed username/password check or an X'FF' method reply points to an authentication problem instead.

Found this useful? Share it.