Connection refused
If your tool says refused, look at the proxy address you configured. If the site had refused, you would be reading a 502.
- Usually from
- The proxy address in your config
- Try first
- Check host and port against the dashboard, then test in curl
What a refused connection means through a proxy
At the TCP level, refused means a host was reachable and nothing was listening on that port, or a firewall rejected the connection outright. A dropped connection looks different: it hangs, then times out.
With a proxy set, your client only ever opens a connection to the proxy. So a refused error from your client was refused on that leg.
When the site refuses the proxy’s outgoing connection, you do not see a refused error. The proxy turns it into a status on the CONNECT, typically 502, and your tool reports a tunnel failure.
Your credentials, the proxy, or the target?
If your tool says refused, look at the proxy address you configured. If the site had refused, you would be reading a 502.
Your credentials
Not the cause. Credentials are checked after a connection is accepted.
The proxy
The proxy address your config points at: a mistyped host or port, or an old address copied from an earlier order. The dashboard lists the current ones.
The target site
Only indirectly. A site refusing the proxy shows up as a 502 on the CONNECT.
How to tell
- Refused within milliseconds: something answered and said no. A long wait followed by an error is a timeout.
nc -vz HOST PORTagainst the proxy address shows whether anything is listening there at all.- curl prints
Failed to connect towith the proxy host and port, and exits with code 7. - Python Requests raises
ProxyErrorwithConnection refusedin it; Node putsECONNREFUSEDonerr.cause; Chromium saysnet::ERR_PROXY_CONNECTION_FAILED.
Fixes, in the order to try them
- Costs nothing
Compare host and port with the dashboard
Character by character. The residential gateway and each ISP or datacenter IP have their own host and port, and the dashboard lists them for every order.
- Costs nothing
Check for an empty variable
A proxy URL assembled from environment variables that are not set can end up pointing at your own machine, which refuses. Print the host and port your code is using.
- Costs nothing
Test from the same machine with curl
If curl connects and your program does not, the problem is in the program’s config. If curl is refused too, it is the address or your network.
- Costs nothing
Check the order is still active
An ISP or datacenter address is yours for the term you picked. Look at the order in the dashboard before debugging further.
- Costs some time
Check outbound firewalls
Company networks and some hosting providers restrict outbound ports. A firewall that rejects shows as refused; one that drops shows as a timeout.
See the real status and headers
Each sample prints the host and port that were refused, which is usually enough to spot the mistake.
curl
# is anything listening at the proxy address?
nc -vz resi.proxymonkey.io 8000
nc -vz IP PORT # an ISP or datacenter IP from your order
# which host and port curl tried, and what happened
curl -sv -o /dev/null -x http://USER:[email protected]:8000 https://httpbin.org/ip 2>&1 | head -n 5
# curl: (7) Failed to connect to ... port ...: Connection refusedPython Requests
import os
from urllib.parse import urlsplit
import requests
proxy = os.environ.get("PROXY_URL", "")
parts = urlsplit(proxy)
print("proxy host:", parts.hostname, "port:", parts.port)
try:
requests.get("https://httpbin.org/ip", proxies={"http": proxy, "https": proxy}, timeout=15)
except requests.exceptions.ProxyError as err:
print(err)Set PROXY_URL to http://USER:PASS@IP:PORT for a rented IP, or to the residential gateway.
Scrapy
from urllib.parse import urlsplit
from twisted.internet.error import ConnectionRefusedError
def start_requests(self):
for url in self.start_urls:
yield scrapy.Request(url, errback=self.on_error)
def on_error(self, failure):
if failure.check(ConnectionRefusedError):
proxy = urlsplit(failure.request.meta.get("proxy", ""))
self.logger.error("refused at %s:%s", proxy.hostname, proxy.port)The log line prints host and port only, so the password stays out of your logs.
Playwright
from playwright.sync_api import Error, sync_playwright
PROXY = {"server": "http://resi.proxymonkey.io:8000", "username": "USER", "password": "PASS"}
with sync_playwright() as p:
browser = p.chromium.launch(proxy=PROXY)
page = browser.new_page()
try:
page.goto("https://httpbin.org/ip")
except Error as err:
print(err.message.splitlines()[0])
browser.close()
# net::ERR_PROXY_CONNECTION_FAILED nothing accepted the connection at the proxy address
# net::ERR_TUNNEL_CONNECTION_FAILED the proxy answered, but the CONNECT failedNode.js
import { fetch, ProxyAgent } from "undici";
const dispatcher = new ProxyAgent("http://USER:[email protected]:8000");
try {
await fetch("https://httpbin.org/ip", { dispatcher });
} catch (err) {
const { code, address, port } = err.cause ?? {};
console.error(code, address, port);
}
// ECONNREFUSED 203.0.113.7 8000The samples use the residential gateway, resi.proxymonkey.io:8000. For an ISP or datacenter IP, use USER:PASS@IP:PORT for the address you rented. Your dashboard lists the host and port for every order, and where it differs from this page, the dashboard is right.
Will a different proxy line fix it?
When switching helps
No line fixes a refused connection by itself. A new order helps only when the one you point at has ended, and renewing that one works as well.
When it will not
A typo, an empty variable or a firewall follows you to every line. Fix the address first.
Is a failed request billed?
We bill for request bytes and response bytes, including headers and protocol overhead on the tunnelled connection. Connections that fail before transferring data are not billed. Retries that you initiate are billed and appear as separate entries in your usage log.
The terms say connections that fail before transferring data are not billed. A refused connection is turned away before anything transfers. Retries you initiate are billed as separate entries once they do move data.
Residential is billed per GB of that traffic. ISP and datacenter addresses are charged per IP for their term, and where a plan includes a traffic allowance, traffic past it is billed per GB under the same rule. The usage log in your dashboard has one row per request with bytes in, bytes out and cost, so you can look up the failed request yourself.
Questions people ask about a refused connection
Is connection refused the website blocking me?
Not while a proxy is set. Your client only connects to the proxy, so a refused error is about the proxy address. A site refusing the proxy produces a 502 on the tunnel.
What is the difference between refused and timed out?
Refused is an instant no: a host answered and nothing accepted the connection. Timed out is silence: the packets went nowhere, or something dropped them. Refused points at the address; a timeout points at the network or a slow leg.
My ISP proxy worked yesterday and is refused today. Why?
Check the order in the dashboard first, since an address is yours for the term you bought. If the order is active and curl from your machine is refused too, post the curl output in the Discord with the password removed.
Does SOCKS5 give the same error?
On the leg to the proxy, yes: refused is refused. Past that, a SOCKS5 proxy reports a target that refused through its own reply codes, which curl shows as a SOCKS error instead of a 502.
Errors that travel with this one
- TIMEOUT
Connection timeout
Nothing came back in time. Find out which leg stalled before you raise the limit.
Work it out → - 502
502 Bad Gateway
A go-between got a bad answer from the next hop. Could be the proxy, could be the site’s own load balancer.
Work it out → - 407
407 Proxy Authentication Required
The proxy did not accept your login. Nearly always the credentials, or the way your tool sends them.
Work it out →
Still stuck on a refused connection?
Paste your error in the Discord: the full message plus the command or the few lines that set up the proxy, with the password taken out. Someone there has seen it before.
Join the Discord4,200+monkeys in the Discord
Help from humans
Post your error, get an answer. Usually in minutes, usually from someone who has hit the same wall.
A status bot that tells on us
Pool health, incidents and maintenance posted automatically. Including the bad days.
Deals and free traffic
Bonus GB drops, early access to new pools, and the occasional giveaway for a good bug report.