Errors & CAPTCHAs

407 Proxy Authentication Required: your proxy wants a login

Proxy errors · 407
Published

What you see

  • 407 Proxy Authentication Required
  • HTTP/1.1 407 Proxy Authentication Required
  • Tunnel connection failed: 407 Proxy Authentication Required
  • ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required'))
More error strings (4)
  • requests.exceptions.ProxyError
  • curl: (56) CONNECT tunnel failed, response 407
  • net::ERR_INVALID_AUTH_CREDENTIALS
  • No proxy credentials provided. Please add credentials and try again.

What it means

Your proxy (the middleman server your requests go through) said no. It wants a login, and it didn’t get a valid one. The website never saw your request.

Why it happens

  1. No login sent. The proxy needs a username and password, and your code sent none.
  2. Wrong login. A typo, an old password, or the wrong user format. Bright Data, for example, returns 407 for a wrong password, a wrong account ID or a zone name that doesn’t exist.
  3. The login got lost on the way. Your tool dropped it. Common traps:
    • a password with @ or : that breaks the proxy URL,
    • credentials written inside a browser tool’s proxy URL, which some tools drop,
    • an old HTTPS_PROXY environment variable that wins over your code.
  4. Your IP is not on the allowlist. Some proxies skip passwords and only let in IPs you registered. A new server, VPN or home IP is a stranger to them.
  5. Both methods at once. Oxylabs warns that sending a login from an IP that is already allowlisted can cause 407 errors in browsers.
  6. Your account is blocked. Bright Data also answers 407 when an account is suspended or needs identity checks (KYC).

A proxy login is just one header. After a 407, your client sends the request again with Proxy-Authorization. With the common Basic scheme, that header holds user:password written in Base64. Base64 is a way of spelling text, not a lock.

Small slips break it because the format is strict:

  • The first colon splits user from password, so a username can’t contain a colon (RFC 7617).
  • Inside a proxy URL, @ and : are separators too. That is why curl asks you to write them as %40 and %3a.

The username often carries more than your name. Bright Data’s login is built from your account ID, zone name and password. With Oxylabs IP allowlisting, targeting options can’t go in the username at all; they move into the host name instead.

One more Bright Data trap: an account is suspended automatically when its balance goes negative.

Fix it

  1. Read the error body or headers. Many providers tell you the exact reason there (see Dev details).
  2. Test the proxy alone with curl, outside your code: curl -v -x http://proxy.example:8080 -U user:pass https://example.com If this works, the proxy is fine and your code is the problem. Our free proxy checker shows what gets through.
  3. Copy the login again from your provider’s dashboard. Check the username format (some put account, zone or country inside it).
  4. Escape special characters. In a proxy URL, write @ as %40 and : as %3a.
  5. Pass the login the way your tool expects it:
    • requests: http://user:pass@host:port in proxies
    • Playwright: username and password fields, not inside server
    • Puppeteer: proxy host in proxyServer, login with page.authenticate()
  6. Using an IP allowlist? Add your server’s current public IP in the dashboard, and stop sending a username and password.
  7. Still 407? Check that your account is active, then contact the provider with the error code they returned.

Why curl first: it takes your code out of the picture. With -v, it prints every line, so you see the CONNECT request and the proxy’s answer. If curl gets through with the same host, port, user and password, the proxy and the account are fine. The bug is in how your code passes them.

On allowlists, details matter:

  • Oxylabs takes up to 10 public IPv4 addresses per Residential Proxies instance.
  • One IP can sit on only one instance at a time.
  • Check your public IP with VPNs and local proxy apps turned off, or you register the wrong address.
  • A team sharing one office IP is better off with passwords, Oxylabs says.

Keep the login out of git. The requests docs call storing it in an environment variable or a committed file a security risk.

Paste this into your AI

My scraper fails with this proxy error:
"<paste the exact error or the status line>"
Explain in plain words what a 407 from a proxy means.
Then list the likely causes in order, most likely first.
For each cause, give one quick test and one fix.
My setup: <language + library, e.g. Python requests / Playwright / Puppeteer / curl>,
how I pass the proxy (<proxy URL with user:pass / username+password fields / IP allowlist>),
target URL starts with <http:// or https://>,
proxy provider: <provider and product>.
Never ask me to paste my real password.

Dev details

The proxy answers with a challenge. The client may retry with a Proxy-Authorization header (RFC 9110):

HTTP/1.1 407 Proxy Authentication Required
Proxy-Authenticate: Basic realm="Access to internal site"

http:// vs https:// targets. For a plain http:// URL, the proxy sends the 407 back as a normal response. For https://, your client first asks the proxy to open a tunnel (CONNECT host:443). The proxy refuses with 407, so you get a connection error instead of a status code:

> CONNECT httpbin.testdomain.com:443 HTTP/1.1
< HTTP/1.1 407 Proxy Authentication Required
< Proxy-Authenticate: Basic realm="Squid proxy-caching web server"
curl: (56) CONNECT tunnel failed, response 407

In libcurl, the 407 from the tunnel sits in CURLINFO_HTTP_CONNECTCODE, not in the normal response code.

curl. -U / --proxy-user sends the proxy login. --proxy-anyauth lets curl pick the auth method. curl URL-decodes a user and password written in the -x proxy string.

curl --proxy-anyauth --proxy-user user:passwd -x http://proxy.example:8080 https://example.com

Python requests. For an https:// target you get an exception, not a response:

requests.exceptions.ProxyError: HTTPSConnectionPool(host='example.com', port=443): Max retries exceeded with url: /justanexample (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required')))
import requests

proxies = {
    "http": "http://user:pass@10.10.1.10:3128",
    "https": "http://user:pass@10.10.1.10:3128",
}
requests.get("https://example.com", proxies=proxies)

Values in session.proxies get overwritten by environment proxies (HTTP_PROXY, HTTPS_PROXY, ALL_PROXY). Pass proxies= on each request to be sure yours are used.

Other ProxyError and SSLError messages in Python (wrong scheme, refused port, proxy certificates): /errors/python-requests-proxyerror.

requests takes the user and password from the proxy URL, URL-decodes them, and sends them as a Basic Proxy-Authorization header. So p%40ss in the URL reaches the proxy as p@ss.

Playwright.

const context = await browser.newContext({
  proxy: { server: 'http://myproxy.com:3128', username: 'usr', password: 'pwd' },
});

In @playwright/mcp 0.0.83, a login inside --proxy-server http://user:pass@host:port was dropped. The page failed with net::ERR_INVALID_AUTH_CREDENTIALS although no credentials were ever sent. The issue was closed as completed on 2026-10-03, labelled v1.64.

Puppeteer.

const browser = await puppeteer.launch();
const context = await browser.createBrowserContext({ proxyServer: 'http://proxy.example:8080' });
const page = await context.newPage();
await page.authenticate({ username: 'user', password: 'pass' });

page.authenticate() turns on request interception behind the scenes, which can slow pages down.

Provider headers (Bright Data). The reason comes in x-brd-error, x-brd-err-msg and an RFC 9209 Proxy-Status header:

Proxy-Status: brd.superproxy.io; received-status=407; error="http_request_denied"; details="client_10000: Invalid authentication: check credentials and retry. Bright Data credentials include your account ID, zone name and password"
code what it means
client_10000 wrong password or wrong account ID
client_10002 zone not found
client_10010 no proxy credentials sent
client_10020 account suspended
client_10030 your IP is not on the zone’s allowlist
client_10040 KYC required

A 407 is not always a failure. RFC 9110 says a proxy should send it when credentials are missing, wrong or partial. Partial matters for schemes that need more than one round trip, like Digest or NTLM: there, the first 407 is part of the handshake. That is also why curl’s --proxy-anyauth may cost one extra request.

Credentials work per hop. Proxy-Authorization is used up by the first proxy that asked for it. In a chain of proxies, a proxy only passes it on if they are set up to share it.

Mind the wire. RFC 7617 says Basic sends the password as cleartext unless TLS protects the connection. curl can talk to an HTTPS proxy with the https:// prefix in -x, and checks that proxy’s certificate.

If a valid login still isn’t enough to get access, RFC 9110 says the answer ought to be 403, not 407.

Questions

What is the difference between 401 and 407?

401 comes from the website and asks you to log in to the site. 407 comes from the proxy in between and asks you to log in to the proxy. The proxy sends a Proxy-Authenticate header; you answer with Proxy-Authorization (RFC 9110).

Why do I get 407 when my username and password are correct?

Check what really reaches the proxy. Requests lets environment variables like HTTPS_PROXY overwrite session.proxies, and some tools drop user:pass written inside a proxy URL. Oxylabs also warns that sending a login from an already allowlisted IP can cause 407 errors in browsers.

Can I put user:pass in Chrome's --proxy-server?

Don't rely on it. Puppeteer's docs say to set the proxy server alone (proxyServer) and give the username and password with page.authenticate(). Playwright takes them as separate username and password fields.

scrapenews difficulty

Not scored. We have 1 of 8 factors; a score needs 3.

FactorWhat we foundSource
Smallest client that gets througha plain HTTP clientdeveloper.mozilla.org

Our analysis of 1 sourced facts; measured runs replace them as they come. How we rate difficulty

Tools that get past it

ToolPrice
Playwright: Microsoft's framework to drive Chromium, Firefox and WebKit from code with one API. Made for testing; also used to scrape.Free
Puppeteer: JavaScript library to control Chrome and Firefox from code.Free
Requests: The classic simple HTTP library for Python.Free

Sources

  1. RFC 9110 §15.5.8: 407 Proxy Authentication Required rfc-editor.org
  2. MDN: 407 Proxy Authentication Required developer.mozilla.org
  3. RFC 7617: The 'Basic' HTTP Authentication Scheme rfc-editor.org
  4. Requests docs: Proxies requests.readthedocs.io
  5. psf/requests source: adapters.py (proxy_headers) github.com
  6. psf/requests source: utils.py (get_auth_from_url) github.com
  7. psf/requests issue #6043: 407 Proxy Authentication Required on 2.27.1 github.com
  8. curl man page: --proxy, --proxy-user, --proxy-anyauth curl.se
  9. curl discussion #15718: curl response to proxy authentication 407 github.com
  10. Playwright docs: HTTP Proxy playwright.dev
  11. microsoft/playwright issue #43048: --proxy-server drops credentials written in the URL github.com
  12. Puppeteer: Page.authenticate() pptr.dev
  13. Puppeteer: BrowserContextOptions (proxyServer) pptr.dev
  14. Puppeteer: Browser.createBrowserContext() pptr.dev
  15. Bright Data Docs: Proxy errors troubleshooting docs.brightdata.com
  16. Oxylabs Docs: IP Whitelisting & Auth (Residential Proxies) developers.oxylabs.io