When a Proxy Works in curl but Not in the Browser

· Updated:

If a proxy works in curl but not in the browser, the proxy itself is fine; the two programs are not using the same settings. curl takes the proxy, login and protocol from your command line or environment, while a browser takes them from the operating system, an extension or a PAC file, and Chromium cannot send a SOCKS5 username and password at all. Compare what each tool really uses and the difference shows up quickly.

Same line, every tool: compare against a known-good test

Why a proxy works in curl but not the browser

A working curl test proves three things: the IP and port answer, the login is accepted, and the proxy can reach the website. So the failure in the browser comes from one of these differences:

  • A different proxy source. curl may be using an environment variable or ~/.curlrc you forgot about, while the browser uses system settings, an extension or a PAC script.
  • Login handling. curl sends the username and password with the first request; browsers ask in a dialog, take them from an extension, or cannot send them for SOCKS5.
  • Protocol. The browser is set to SOCKS5 or "HTTPS proxy" while the port expects HTTP, or the reverse.
  • Something in front of the browser. A VPN extension, a security product or a bypass rule sends the browser around the proxy.

Step 1: confirm what curl is really using

Before blaming the browser, make sure curl is testing the line you think it is. Disable ~/.curlrc, pass the proxy explicitly and list any proxy variables in the shell:

# -q must come first: it skips ~/.curlrc, so only the proxy you pass is used
curl -q -v --max-time 20 -x http://USER:[email protected]:8080 https://proxyv4.com/api/my-ip
env | grep -i _proxy

The verbose output names the proxy curl connected to, and the body shows the exit IP. If the variables list shows a proxy you did not expect, earlier tests may have gone through that one instead.

How environment variables override tools

Command-line tools read http_proxy, https_proxy, all_proxy and no_proxy from the shell. curl reads http_proxy only in lowercase, while it accepts HTTPS_PROXY and ALL_PROXY in either case, so a variable that looks set may not apply. A browser started from the desktop, the dock or the Start menu does not see variables you exported in a terminal.

Python behaves differently again. requests honors these variables and, on Windows and macOS, can also pick up the system proxy settings through the standard library. When a proxy works in the browser but not Python, or the other way round, check whether Python is quietly using a second proxy, and turn that off for the test:

import requests

PROXY = "http://USER:[email protected]:8080"
s = requests.Session()
s.trust_env = False  # ignore env vars and system proxy settings
r = s.get("https://proxyv4.com/api/my-ip",
          proxies={"http": PROXY, "https": PROXY}, timeout=(10, 30))
print(r.text.strip())

Step 2: check how the browser gets its proxy

Each browser has its own source of truth, and the one shown in the settings page is not always the one in effect.

Chrome and Edge

Chromium browsers normally follow the operating system's proxy settings (on Linux, the desktop environment's settings or environment variables, depending on setup). An extension can take over, in which case the settings page says the proxy is controlled by that extension. To see what Chrome is actually using, open chrome://net-internals/#proxy.

The --proxy-server launch flag accepts a host and port but not a username and password. With an authenticated HTTP proxy, Chrome shows a sign-in dialog instead; automation and headless runs that cannot answer that dialog fail. Use a proxy extension that stores the login, or follow the Chrome proxy setup guide.

Firefox

Firefox can use its own network settings rather than the system's, so a proxy set in Windows or macOS may not apply. Open the connection settings (labels vary by version) and check whether it is set to system, manual or automatic configuration, and whether an extension controls it.

SOCKS5 with a username and password

curl handles authenticated SOCKS5 with socks5h://USER:PASS@IP:PORT. Chromium browsers do not support SOCKS5 login, and Firefox's manual SOCKS settings have no login fields either. If the browser is set to SOCKS5, switch it to HTTP for an authenticated proxy, or use an extension that documents SOCKS5 authentication.

Step 3: remove what sits between the browser and the proxy

  • Extensions. VPN, privacy and other proxy extensions can override the setting. Test in a fresh profile or a guest window with no extensions.
  • PAC scripts. A proxy auto-config file can send some hosts direct. If the system uses one, check its rules or turn it off for the test.
  • Bypass lists. Local and intranet addresses are usually excluded, and recent Chrome versions skip the proxy for localhost by default. Test against a public site, not a local service.
  • Security software. Products that inspect HTTPS traffic or filter outbound ports can block the browser while leaving curl alone. Try another network to rule out the office or Wi-Fi filter.
  • A wrong protocol choice. "HTTPS proxy" in some apps means TLS to the proxy itself. For a normal HTTP proxy that carries https:// sites, choose HTTP.

One proxy line that behaves the same in every tool

Most of these mismatches come down to protocol and login. Every ProxyV4 proxy supports HTTP(S) and SOCKS5 with username and password, and from the order's page you choose HTTP only, SOCKS5 only or both on the same port. With both enabled, Chrome can use the line as HTTP while curl or a script uses SOCKS5, with the same credentials. Switching modes can move the proxy to a new port, so copy the line again afterwards.

The addresses are private datacenter IPv4 in seven countries and static ISP in 23 countries, one tenant per IP, unmetered traffic, and the same IP when you renew before expiry.

It is not the answer if the browser has to send a SOCKS5 login with no extension, if you need per-request rotation, or if you need mobile IPs. IPv6 proxies are a separate product that only works on IPv6-ready sites. See live prices and test one IP in both curl and your browser first.

Step 4: compare exit IPs

When you think it is fixed, check the same line in the proxy checker, then open the my IP tool in the browser. The address the browser shows must match the exit IP from curl and the checker. If the browser shows your own IP, it is still going around the proxy; if it shows a different proxy, another setting is in charge.

If the checker fails as well, the problem is the line, not the browser: see ERR_PROXY_CONNECTION_FAILED. A ProxyV4 proxy that fails for a technical reason is covered by the refund policy as a balance credit.

Frequently asked questions

Why does Chrome ignore the username and password in --proxy-server?

The flag only takes a host and port. Chrome asks for the login in a dialog, or you can use an extension that stores it.

Can Chrome use a SOCKS5 proxy with a username and password?

Not natively; Chromium does not support SOCKS5 login. Use HTTP for an authenticated proxy, or an extension that supports SOCKS5 authentication.

Why does my proxy work in the browser but not in Python?

Python reads environment variables and, on Windows and macOS, system proxy settings, so it may be using a different proxy or none. Set the proxy explicitly in code and disable trust_env while testing.

Do ProxyV4 proxies work as both HTTP and SOCKS5?

Yes. Choose both on the order's page and one port accepts either protocol with the same login.

Does curl use the Windows or macOS proxy settings?

No. curl uses the -x option, environment variables or ~/.curlrc, not the system proxy settings.

Same line, every tool: compare against a known-good test

Every ProxyV4 proxy supports HTTP(S) and SOCKS5 with username and password, both on one port if you choose. Start with one IP and check it in curl and your browser.

Get a working proxy

Related articles

Proxy setup
Using cURL with an authenticated proxy: commands that prove it works
Send cURL requests through an authenticated HTTP(S) proxy with -x and -U, confirm the exit IP, read the CONNECT handshake and time each request on any OS.
Proxy setup
Routing Google Chrome Through a Private Proxy
Put an HTTP(S) proxy on Google Chrome only, not the whole computer: a per-profile extension, a --proxy-server launch shortcut, or the system proxy settings.
Free tools
Check proxies in bulk: status, exit IP and latency
Free online proxy checker: paste up to 100 ip:port:user:pass lines and see which proxies work, their exit IP and latency, plus what each failure result means.
Knowledge base
HTTP or SOCKS5: Picking the Proxy Protocol Your Software Needs
HTTP vs SOCKS5 proxy in plain terms: what each protocol carries, why HTTPS works through both, where UDP matters, and how to test which one a server speaks.
Proxy errors
Proxy errors explained, with fixes
Proxy error pages each take one message, explain what it means, list the usual causes and walk through the fix in Windows, Chrome, antidetect browsers, phones and code. Every output shown was reproduced with real test proxies. If your error is not listed, check the message against the proxy checker first: it shows whether the proxy itself answers, so you know whether to look at the proxy or at your own setup.
Knowledge base
Why Your Proxy Is Slow and How to Speed It Up
Why is my proxy slow? Time each leg of the request with curl, then fix the usual causes: a far location, new connections per request, DNS and site throttling.
Knowledge base
Why Your Proxy Shows the Wrong Country and How to Fix It
Proxy shows the wrong country? Compare the IP across geolocation databases, rule out cookies and account settings, and know when to ask for a correction.
Knowledge base
How to Diagnose and Prevent a Proxy DNS Leak
A proxy DNS leak sends lookups to your local resolver while traffic uses the proxy. Learn to test for it and fix it with socks5h, browser settings and code.
Products
Dedicated datacenter proxies: one private IPv4 per customer
Private IPv4 proxies in the US, Vietnam, Japan, South Korea, Singapore, the UK and Hong Kong. One tenant per IP, HTTP(S) and SOCKS5, no traffic metering.
Products
Static ISP proxies: residential IPs on consumer networks
Static ISP proxies in 23 countries, from Germany and the UK to the US, Brazil and Japan: fixed IPs on consumer networks, one customer each, unmetered traffic.