Guides · 7 min
Proxy Error 407 and Other Proxy Errors: Causes and Fixes
- TrueSocks editorial team
- 7 min read
HTTP 407 Proxy Authentication Required means the proxy itself refused your request because it did not get valid credentials: the login or password is wrong, missing, badly encoded, or your IP is not on the proxy's allowlist. Most other proxy errors fall into a few groups too: the proxy cannot be reached at all, the protocol does not match the port, or the proxy reached the website but the website refused or did not answer. This guide explains how to tell these groups apart and fix each error, with ready commands for curl, Python and browsers.
Key takeaways
5 points- 407 comes from the proxy, not the website: check login, password, special characters and the IP allowlist.
- 403 and 429 come from the target site: the proxy works, but the IP, request rate or client fingerprint is not welcome.
- 502, 503 and 504 mean the proxy could not get a good answer from the next hop; retry, then check the target and the protocol.
- Connection refused, reset or an instant failure usually means the wrong port or HTTP spoken to a SOCKS5 port.
- Isolate the problem with one curl command before touching browser or app settings.
First question: who returned the error?
Every request through a proxy has two legs: from you to the proxy, and from the proxy to the website. An error can come from either side, and the fix depends on which. The quickest way to tell them apart:
| Error | Who sends it | What it usually means |
|---|---|---|
407 Proxy Authentication Required | Proxy | Missing or wrong credentials, or your IP is not allowlisted |
| Connection refused, reset, timed out | Network or proxy | Wrong host or port, protocol mismatch, firewall |
502 Bad Gateway | Proxy | The proxy got an invalid answer or no connection from the target |
503 Service Unavailable | Proxy or target | Overloaded or unavailable upstream, sometimes a rate limit |
504 Gateway Timeout | Proxy | The target did not answer the proxy in time |
403 Forbidden | Target site | The site refuses this IP or this client |
429 Too Many Requests | Target site | Rate limit on the IP or session |
A simple test: request a plain IP echo service through the proxy. If that works and only your target fails, the proxy is fine and the problem is the target's reaction to your traffic.
curl -v -x http://login:[email protected]:8000 https://api.ipify.org407 Proxy Authentication Required
A 407 response is the proxy's way of saying "who are you?". It comes with a Proxy-Authenticate header, typically Basic realm=..., and the client is expected to retry with a Proxy-Authorization header. In curl it usually shows up as Received HTTP code 407 from proxy after CONNECT; in Python requests as ProxyError ... Tunnel connection failed: 407 Proxy Authentication Required.
Causes and fixes
Copy the credentials again
Logins and passwords are case sensitive. Copy them from the order page, check for trailing spaces and line breaks, and make sure login and password did not swap places when the string was split.
Encode special characters
If the password contains
@,:,/,#or%, it breaks thelogin:password@host:portURL format. URL-encode it (@becomes%40,:becomes%3A) or pass credentials separately, for example with curl's-U login:password.Check the authorization method
If the proxy uses an IP allowlist instead of a login, it answers 407 to any address that is not on the list. Your IP changes when you switch networks or turn on a VPN. Add the new address or switch to login and password.
Check the expiry date
An expired rental usually fails authentication. Confirm the proxy is still active.
Check the client supports proxy auth
Chrome's
--proxy-serverflag ignores credentials in the URL, and Chromium does not support username and password for SOCKS5 at all. Use the app's own auth field, an extension, an IP allowlist or a local forwarder.
from urllib.parse import quote
login = 'user123'
password = quote('p@ss:word#1', safe='') # 'p%40ss%3Aword%231'
proxy = f'http://{login}:{password}@203.0.113.10:8000'Connection refused, reset or timed out
These errors mean you never had a working conversation with the proxy. In Chrome and Edge they appear as ERR_PROXY_CONNECTION_FAILED or ERR_SOCKS_CONNECTION_FAILED; in curl as error (7) Failed to connect or (28) Connection timed out.
- Refused instantly: the host is reachable but nothing listens on that port. Check the port number in your order.
- Reset or empty reply: something answered, but in a different protocol. Speaking HTTP to a SOCKS5 port or SOCKS5 to an HTTP port looks exactly like this.
- Timed out: wrong host, the proxy is down, or a firewall, antivirus or corporate network on your side blocks outgoing connections to that port. Try from another network such as mobile data to rule out your side.
- Could not resolve proxy (curl error 5): a typo in the hostname or an invisible character copied with it.
# as HTTP
curl -v -x http://login:[email protected]:8000 https://api.ipify.org
# as SOCKS5 with DNS on the proxy side
curl -v -x socks5h://login:[email protected]:8000 https://api.ipify.orgIf one works and the other does not, you have found a protocol mismatch. Many providers issue separate ports for HTTP and SOCKS5. The differences between the two are explained in what is a SOCKS5 proxy.
ERR_TUNNEL_CONNECTION_FAILED and CONNECT failures
To open an HTTPS site, the browser asks an HTTP proxy to create a tunnel with CONNECT host:443. ERR_TUNNEL_CONNECTION_FAILED means the proxy did not return 200 Connection established. Typical reasons:
- Authentication failed during CONNECT (a 407 hidden behind the generic message).
- The proxy could not reach the target host or port, or does not allow CONNECT to that port.
- An IPv6-only proxy was asked to reach a site that has no IPv6 address; see IPv4 vs IPv6 proxies.
- Antivirus or a corporate filter on your machine intercepts HTTPS and breaks the tunnel.
Test with curl -v and look at the line after CONNECT: it shows the exact status the proxy returned, which the browser hides.
502 Bad Gateway, 503 Service Unavailable, 504 Gateway Timeout
These are gateway errors: the proxy accepted your request but could not get a valid response from the next hop. With rotating residential and mobile pools, the next hop is often a home or carrier connection that just went offline.
| Code | Likely cause | Fix |
|---|---|---|
| 502 | Target refused the connection, or the exit node dropped | Retry with a new session; check the target opens directly |
| 503 | Proxy or exit pool overloaded, or a rate limit | Back off and retry; reduce concurrency |
| 504 | Target or exit too slow to answer | Raise timeouts, use a closer country, retry |
import time, random, requests
PROXY = 'http://login:[email protected]:8000'
def get(url, tries=4):
for i in range(tries):
try:
r = requests.get(url, proxies={'http': PROXY, 'https': PROXY}, timeout=20)
if r.status_code in (502, 503, 504, 429):
raise requests.HTTPError(r.status_code)
return r
except (requests.ConnectionError, requests.Timeout, requests.HTTPError):
time.sleep(2 ** i + random.random())
raise RuntimeError('proxy request failed: ' + url)403 Forbidden and 429 Too Many Requests
When you get 403 or 429 from the target, the proxy has done its job: your request arrived. The site decided it does not like the source. Three things decide that: the IP and its network type, the request rate, and how much your client looks like a real browser.
Fixes that usually help
- Lowering requests per IP and adding random delays.
- Honoring
Retry-Afteron 429 responses. - Sending realistic headers and keeping cookies per session.
- Switching to ISP, residential or mobile IPs for strict sites.
Fixes that rarely help
- Retrying the same request instantly in a loop.
- Buying more IPs from the same blocked subnet.
- Changing proxy protocol from HTTP to SOCKS5: the site sees the same IP.
- Rotating IPs on a logged-in session, which looks like account theft.
Pool size and rotation strategy are covered in how many proxies do I need and rotating vs static proxies.
Errors in Python, Node.js and browsers
| Message | Meaning | Fix |
|---|---|---|
InvalidSchema: Missing dependencies for SOCKS support | Python requests without SOCKS support | pip install requests[socks] |
ProxyError: Cannot connect to proxy | Proxy unreachable from your machine | Check host, port and firewall |
SSLError only through the proxy | Wrong scheme or an intercepting filter | Use http:// for the proxy URL even for HTTPS targets |
ERR_NO_SUPPORTED_PROXIES | Chromium got a proxy setup it cannot use, for example SOCKS5 with credentials | Use the HTTP port or a local forwarder |
| Browser keeps asking for login | Wrong credentials or a cached bad login | Restart the browser, re-enter credentials |
| Works in curl, fails in the app | App settings: protocol, DNS mode, system proxy | Compare the exact URL the app uses |
http:// even for HTTPS sites.Browser automation has its own quirks with authentication. Ready code for each framework is in proxies for Selenium, Playwright and Puppeteer, and antidetect tools are covered in the antidetect browser proxy setup.
A 5-minute troubleshooting checklist
- Validate the proxy line in the free proxy checker: it parses
ip:port:login:password,login:password@ip:portand URL formats and flags broken lines. - Run one
curl -vrequest to an IP echo service. Note the exact error. - If you see 407: credentials, special characters, allowlist, expiry.
- If the connection fails: port, protocol, firewall. Try both
http://andsocks5h://. - If the proxy works but the target fails: rate, headers, IP type. Test the target in a browser through the same proxy.
- Only then change app settings, and compare them with the working curl command.
Frequently asked questions
What does 407 Proxy Authentication Required mean?
The proxy server rejected the request because it did not receive valid credentials. Check the login and password, encode special characters, and make sure your current IP is allowlisted if the proxy uses IP authorization.
What is the difference between 407 and 401?
401 Unauthorized comes from the website and asks you to log in to the site. 407 comes from the proxy and asks for proxy credentials. They use different headers: WWW-Authenticate for 401 and Proxy-Authenticate for 407.
Why do I get 502 Bad Gateway through a proxy?
The proxy could not get a valid response from the target or from its exit node. On rotating pools an exit node may have gone offline. Retry with a new session and check that the site opens without the proxy.
Why does my proxy work in curl but not in my browser?
The browser is using a different protocol, port or authentication method, or a system proxy and extensions interfere. Chromium also does not support SOCKS5 with a password. Match the browser settings to the working curl command.
Proxies for this task
Starting price per unit for the base term. Countries and volume discounts are listed on each product page.
- Choose country
Dedicated IPv4 proxies
68 countries, from $2.22 per IP / 30 days
- Choose country
Static ISP proxies
60 countries, from $4.33 per IP / 30 days
- Choose country
Residential proxies
60 countries, from $1.85 per GB / 30 days
- #proxy errors
- #407
- #troubleshooting
- #curl
- #python
Proxies are provided for lawful use only. Spam, fraud and hacking are prohibited; follow the rules of the platforms you work with. Terms of service
Related articles
All articles- SECSecurity
How to Test a Proxy: Speed, Anonymity, Geolocation and Leaks
Step-by-step proxy test checklist: string format, curl connectivity, exit IP, geolocation, latency to the real target, anonymity headers, WebRTC and DNS leaks.
8 min - GDGuides
What Is a SOCKS5 Proxy and How Is It Different from HTTP?
SOCKS5 proxy explained: how the handshake and authentication work, how it differs from HTTP proxies and CONNECT, remote DNS with socks5h, and which apps support it.
8 min - GDGuides
Proxies in Selenium, Playwright and Puppeteer: Setup Guide
How to use proxies with Selenium, Playwright and Puppeteer: code for HTTP and SOCKS5, login and password auth, a proxy per browser context, rotation and leak checks.
7 min