Proxy Error 407: What It Means and How to Fix It

HTTP 407 Proxy Authentication Required means the proxy rejected your login, not the website. What causes it in curl, Python and browsers, and the fixes.

TroubleshootingPublished Oct 25, 20266 min read

On this page

HTTP error 407 Proxy Authentication Required means the proxy server refused your request because it did not receive a valid username and password. The website was never contacted: the problem is between your app and the proxy. In most cases the credentials are mistyped, missing because the tool does not send them, or broken by special characters in a proxy URL. Copy the username and password again from your proxy dashboard, URL-encode any special characters, and check that your tool supports proxy authentication.

With a 407, your app sends no or a wrong login to the proxy, the proxy answers 407 and the website is never reached. With a 401 or 403, the proxy login is OK, the request reaches the website, and the website answers 401 or 403
A 407 stops at the proxy; a 401 or 403 comes back from the website.

What a 407 error means

When a proxy requires a login, it checks every request for a Proxy-Authorization header. If the header is missing or the credentials are wrong, it answers with status 407 and a Proxy-Authenticate header that names the login method it accepts, usually Basic. Your app is expected to retry with the right credentials; when it has none, or the ones it has are wrong, the 407 is what you see.

Three status codes are easy to mix up:

CodeSent byMeansFix
407 Proxy Authentication RequiredThe proxyYour proxy login is missing or wrongProxy username, password and tool settings
401 UnauthorizedThe websiteYour login to the website is missing or wrongYour account on the site
403 ForbiddenThe website (or the proxy, for a blocked request)The request was understood and refusedThe site's access rules, or your request rate

If you see a 401 or 403 instead, the proxy login worked and the request reached the site.

What a 407 looks like in your tools

curl

For an https:// site, curl asks the proxy to open a tunnel, and the 407 stops it there:

bash
curl -x http://HOST:PORT https://example.com
curl: (56) CONNECT tunnel failed, response 407

With -v you can see the exchange. This one sent a wrong password:

text
> CONNECT example.com:443 HTTP/1.1
> Host: example.com:443
> Proxy-Authorization: Basic dXNlcjp3cm9uZw==
>
< HTTP/1.1 407 Proxy Authentication Required
< Proxy-Authenticate: Basic realm="proxy"
* CONNECT tunnel failed, response 407

For a plain http:// site there is no tunnel, so curl prints the proxy's 407 response as the result instead of an error.

Python

Python's http.client, which requests builds on, raises Tunnel connection failed: 407 Proxy Authentication Required for https:// sites; requests reports it as a ProxyError. For http:// sites, requests returns a response with status_code 407.

Browsers and fingerprint browsers

Browsers usually show a login prompt for the proxy, or an error page if you cancel it. Fingerprint browsers and automation tools typically report a failed proxy check when you test the profile's proxy.

How to fix a 407, cause by cause

Four symptoms and fixes: every request fails in every tool, copy the username and password again; the password has @, colon, slash or hash in a proxy URL, URL-encode it so @ becomes %40; it works in one tool and fails in another, check the tool sends proxy credentials; it worked before and fails now, check the plan, balance and route
Match the symptom to the cause before changing settings.

1. The username or password is wrong

The most common cause by far. Typical slips:

  • A space or line break copied with the password.
  • The username and password swapped, or pasted into the wrong fields.
  • Credentials from an older route or another product.

Copy both values again from the dashboard. With NanoIP, residential and mobile credentials belong to the route you generated in Dynamic Routes, and each ISP IP has its own username and password in the ISP Proxies list. Every connection must carry them: there is no IP whitelist, so a tool set to "IP authentication" or "whitelist" mode sends no login and gets a 407.

2. Special characters break the proxy URL

Libraries and command-line tools take the proxy as one URL, http://USERNAME:PASSWORD@HOST:PORT. If the password contains @, :, / or #, the tool splits the URL in the wrong place and sends a wrong login, or fails to read the address at all. Our test with the password p@ss:word gave curl a malformed address:

text
curl: (5) Unsupported proxy syntax in 'http://user:p@ss:word@127.0.0.1:18407': Port number was not a decimal number between 0 and 65535

Encode the special characters and the same login works:

CharacterEncoded
@%40
:%3A
/%2F
#%23
%%25

So p@ss:word becomes p%40ss%3Aword in the URL. Tools with separate username and password fields do not need encoding.

3. The tool does not send proxy credentials

Some ways of setting a proxy have no place for a username and password:

  • Chrome's --proxy-server flag takes only a host and port. Chrome then asks for the login in a prompt, which an automated browser cannot answer. In automation, use the framework's proxy login option (Playwright, for example, accepts a username and password with the proxy) or a tool that handles proxy logins for you.
  • SOCKS5 in Chrome's own proxy settings does not support a username and password at all. Use HTTP(S) there, or a fingerprint browser that handles SOCKS5 logins.
  • Environment variables such as HTTPS_PROXY are read by many tools but not all; a tool that ignores them connects without a proxy, or without the credentials.

If the same credentials work in curl and fail in one tool, the tool is the cause.

4. It worked before and fails now

If nothing changed on your side, check the account:

  • Plan or balance. An expired ISP plan or a used-up residential or mobile package stops the proxy from accepting your connection. The dashboard shows remaining days and traffic.
  • New credentials. If you generated new connection details, every tool that uses the old ones needs updating.

Test the login with curl

Isolate the proxy from your tool by testing it alone. For NanoIP residential and mobile proxies:

bash
curl -x https://gateway.nanoip.net:1111 -U "USERNAME:PASSWORD" https://ipinfo.io/json

For an ISP IP, use its own host and port with -x http://HOST:PORT. Passing the credentials with -U avoids URL encoding altogether. A JSON reply with the proxy's IP and country means the login works and the problem is in the tool's settings; a response 407 means the credentials themselves are wrong. The getting started guide shows where to find each value.

Frequently asked questions

Is a 407 error my fault or the proxy provider's?

Almost always a setting on your side: the credentials, the way the tool sends them, or the account balance. If curl with freshly copied credentials still returns 407, contact the provider.

Can IP whitelisting stop 407 errors?

Some providers let you whitelist your own IP instead of sending a password. NanoIP authenticates every connection by username and password only, which works the same from any network and any device.

Why do I get 407 only for HTTPS sites?

For HTTPS sites the tool opens a tunnel first, and some tools send the proxy credentials with normal requests but not with the tunnel request. Update the tool, or switch to one that sends Proxy-Authorization on CONNECT as well.

Does a 407 use up traffic?

The request stops at the proxy before reaching any website, so no page is loaded through the proxy.

Written by NanoIP Team · Proxy infrastructure and customer support team

Related articles

Troubleshooting

How to Test a Proxy: Six Checks and a Script

Test a proxy before you rely on it: login, exit IP, location, owner, rotation and speed, with a tested Python script and a browser check for WebRTC.

5 min read

Troubleshooting

Proxy Not Working? Find the Cause in Four Checks

Proxy failing to connect, rejecting your login, showing the wrong IP or refused by a site? Check four steps in order, with the real errors each produces.

6 min read

Need help with your setup?

Our support team can check your proxy configuration with you.