Skip to content

407 Proxy Authentication Required: Causes and Fixes

When you see an HTTP 407 Proxy Authentication Required response, the problem is not the website you are trying to reach — it is the proxy server sitting between your device and that website.

How 407 Differs from 401 and 403

These three status codes look similar but point to entirely different places in the network path.

401 Unauthorized means the destination server does not recognize or accept the credentials you presented. The server is saying it needs to know who you are before it serves the requested resource, and it will usually include a WWW-Authenticate header explaining what kind of token or login it expects. You fix 401 by correcting credentials with the target site — not the proxy.

403 Forbidden means the server understood the request and refuses it, whether or not you are signed in, for example because of account permissions or a block on your IP or region. Re-sending the same credentials will not change the outcome.

407 Proxy Authentication Required belongs to the proxy, not the origin server. The proxy sits between you and the destination, and it has decided that your traffic needs a valid username and password before it will relay anything. Only after the proxy accepts your credentials does it forward your request — at which point the destination server may still return 401 or 403 for reasons of its own. The key headers differ too: 401 responses carry WWW-Authenticate while 407 responses carry Proxy-Authenticate. If you are debugging with verbose logging, that header is the clearest signal you are looking at the proxy, not the website.

The Five Most Common Causes

Most 407 errors trace back to a small set of configuration mistakes. Working through them systematically saves time.

1. Missing or incorrect username and password. The proxy credentials may never have been included in the request at all, or they may contain a simple typo. Double-check the username and password against what your provider issued. A case mismatch or a stray space at the end of the field is enough to cause failure.

2. Credentials placed in the wrong field. Many HTTP client libraries and tools distinguish between target-site credentials and proxy credentials. The Authorization header authenticates you to the destination server; the Proxy-Authorization header authenticates you to the proxy. Putting the proxy username and password into the Authorization field produces a 407 every time, because the proxy never sees them.

3. Special characters not URL-encoded. Characters such as @, :, %, #, and & carry special meaning inside a URL. If your password is P@ss:w0rd%, the @ will break the user:password@host parsing and the % may be interpreted as the start of an escape sequence, silently changing the password that the proxy receives. The fix is to URL-encode each special character — for example @ becomes %40. In Python use urllib.parse.quote(), in JavaScript use encodeURIComponent().

4. IP allowlist does not include your address. Some proxy providers restrict access to a list of approved source IPs rather than requiring per-request credentials. If the public IP address you are sending from is not on that list, the proxy may return 407 or close the connection before it even looks at a username or password. Confirm which IP the proxy sees — you can do this with a simple curl command — and verify it matches what your provider has recorded.

5. Wrong protocol for the endpoint. An HTTP proxy cannot authenticate a SOCKS5 client, and a SOCKS5 proxy will not accept an HTTP request. A protocol mismatch usually shows up as a connection or handshake error rather than a 407: an HTTP client on a SOCKS5 port gets no HTTP response at all. Check it anyway before you re-enter credentials. On Proxy302, use http:// with port 2222 and socks5h:// with port 3333, matching the protocol of the asset you bought.

Test the Proxy First with curl

Before touching application code, test the proxy from your terminal with curl.

Use -x to point curl at your proxy. A call without credentials looks like this:

Test the Proxy First with curl: example

curl -v -x http://proxy.example.com:8080 https://ipinfo.io/json

Example only: replace the placeholder values with your own.

Test the Proxy First with curl, continued

The -v flag prints the full conversation, including the Proxy-Authenticate challenge from the proxy and the Proxy-Authorization header curl sends back. If the proxy requires a username and password, add them with the -U flag:

Test the Proxy First with curl: example

curl -v -x http://proxy.example.com:8080 -U "myuser:mypassword" https://ipinfo.io/json

Example only: replace the placeholder values with your own.

Test the Proxy First with curl, continued

If this succeeds — you see HTTP 200 from the target — the proxy credentials are correct and the problem lies in how your application is passing them. If it still fails with 407, the credentials themselves are wrong or the IP is not allowed. -U is short for --proxy-user and sends the credentials to the proxy; -u (--user) sends them to the destination server. The two are easy to mix up.

Fix It in Your Browser

Browsers normally prompt for proxy credentials when they receive a 407. If you see the error instead of a prompt, check the address and port in the OS proxy settings, remove saved proxy credentials (Windows Credential Manager or macOS Keychain) and reload so the browser asks again; to store the login and password, use a proxy extension. macOS also lets you enter them under System Settings → Network → Details → Proxies. On company networks that use Windows-domain sign-in for the proxy, ask your IT team.

Fix It in Python Requests

The requests library passes proxy credentials inside the proxies dictionary. Construct the proxy URL with the username and password embedded, and remember to encode any special characters:

Fix It in Python Requests: example

import urllib.parse

username = "myuser"
password = "P@ss:w0rd%"
encoded_password = urllib.parse.quote(password, safe="")

proxies = {
    "http":  f"http://{username}:{encoded_password}@proxy.example.com:8080",
    "https": f"http://{username}:{encoded_password}@proxy.example.com:8080",
}

Example only: replace the placeholder values with your own.

Fix It in Python Requests, continued

Two common mistakes: omitting the https key (HTTPS requests then go out directly, without the proxy, so you see your own IP instead of a 407) and leaving the password unencoded, which does produce 407.

As an alternative, set the HTTP_PROXY and HTTPS_PROXY environment variables. On macOS or Linux: export HTTP_PROXY="http://user:pass@host:port". On Windows PowerShell: $env:HTTP_PROXY = "http://user:pass@host:port". Requests reads these automatically.

Fix It in Node.js

On Node.js 24.5+ (or 22.21+), set NODE_USE_ENV_PROXY=1 together with HTTPS_PROXY=http://user:pass@host:port and the built-in http/https and fetch use the proxy. On older versions, or for SOCKS5, use https-proxy-agent or socks-proxy-agent and encode the password with encodeURIComponent.

Fix It with Environment Variables

Many command-line tools and libraries read HTTP_PROXY and HTTPS_PROXY from the environment (these are separate from the Windows/macOS system proxy settings) in the form http://username:password@host:port. Set them in your shell profile on macOS or Linux, or in the environment variables dialog on Windows.

When to Ask the Provider

Contact the provider when the address, port, protocol and credentials are all correct and the error persists. Typical cases are an allowlist not yet updated for your current public IP, credentials not yet activated, or an endpoint that is offline.

How to do it with Proxy302

Rotating residential proxies fit this task: you choose the exit country (195+ countries and regions, with state and city on lines that support it) and pay per GB, so you pay only for the traffic you use. The rotating residential page has the setup. The table below shows where exits in 7 countries landed in our latest hourly check; the probe sends its request to ChatGPT, which is only an example target. To check your own exit, use the proxy location guide.

Measured exits: ChatGPT from 7 countries

Measured exits: ChatGPT from 7 countries
ItemCityNetwork (ISP)ASN
United StatesDenver, ColoradoComcast Cable Communications, LLCAS7922
United KingdomChesterfield, EnglandPlusnetAS6871
GermanyKöln, North Rhine-WestphaliaNetCologne Gesellschaft fur Telekommunikation mbHAS8422
JapanKashiwazaki, NiigataNTT DOCOMO BUSINESS,Inc.AS4713
SingaporeSingaporeWhiz Communications Pte LtdAS135600
BrazilEcoporanga, Espírito SantoKMM TELECOM LTDA-MEAS264542
IndonesiaBandar Lampung, LampungPT Telekomunikasi IndonesiaAS7713

Hourly check of the Proxy302 probe, 23 October 2026, 15:47 UTC: one request to ChatGPT per country through a dynamic residential exit, using the public Proxy302 entry. Only the first three octets of an IP are public. One sample per country, not an average; later checks will differ.

How to do it with Proxy302: steps

  1. Step 1

    Open the rotating residential page, choose the line, and keep Protocol on HTTP or choose SOCKS5, then click Review cost and generate.

  2. Step 2

    Open My assets (the console page that holds everything you bought) and copy HOST, PORT, USERNAME and PASSWORD. The Connect page shows a ready example with your own endpoint.

  3. Step 3

    Enter the details in the browser or tool you are setting up.

  4. Step 4

    Confirm the exit with https://ipinfo.io/json through the proxy.

  5. Step 5

    From mainland China, start the helper tool from the Connect page first and keep it open while you use the proxy.

Prices and limits

The Budget line costs US$1.50 per GB, US$1.35 per GB in a 100 GB package and US$1.20 per GB at 300 GB. There is no free trial, and the smallest purchase is 1 GB. Which exit locations are available changes daily.

FAQ

What exactly does the Proxy-Authenticate header tell me?

The Proxy-Authenticate header returned with a 407 response lists the authentication methods the proxy supports — for example Basic, Digest, NTLM, or Negotiate. Basic is the most common for simple username-and-password proxies; NTLM or Negotiate indicate a Windows-domain or Kerberos environment and may require additional client-side support.

Can a proxy return 407 for one request and not another?

Yes. Some proxies challenge only on the first request in a session, or when your public IP changed and the proxy uses an IP allowlist.

Does 407 mean the proxy server is broken?

Not necessarily. A 407 means the proxy is working correctly and enforcing its authentication policy. The request reached the proxy, and the proxy responded appropriately. The issue is that the client did not supply credentials the proxy finds acceptable. If the proxy is completely unreachable you would see a connection timeout or a refused-connection error, not a 407.

Why does curl show HTTP code 000 instead of 407?

For an https:// URL, curl first sends CONNECT to the proxy. If the proxy refuses it with 407, the target never answers, so %{http_code} stays 000. Print the proxy's code with -w "%{http_connect}", or look for "CONNECT tunnel failed, response 407" in -v output.

Should I retry a 407 automatically?

No. A 407 is a configuration problem, not a transient failure. Fix the credentials, encoding or allowlist first, then retry once to confirm.

Reference links

3
  1. Proxy302 product facts and price list

    Product observation · Confirmed on:

    Product facts file of the site (values checked against the console, the backend and the price table on 18-19 October 2026): products, prices in US$ (1 PTC = US$1), lease terms, protocols and ports, countries, quantity limits, no free trial.

  2. Proxy302 hourly connectivity check

    Product observation · Confirmed on:

    Public JSON of the probe at proxy302.com/live/connectivity/chatgpt.json, read 23 October 2026, 15:47 UTC: one request per exit country through a dynamic residential exit; exit city, ASN, network and response time.

  3. Node.js docs: Built-in Proxy Support

    Official documentation · Confirmed on:

    Read on 24 October 2026: since Node.js v24.5.0 and v22.21.0, setting NODE_USE_ENV_PROXY=1 or --use-env-proxy makes the global agent use HTTP_PROXY, HTTPS_PROXY and NO_PROXY.

Ready to try it?

Create an account, top up once, then pick rotating residential, static ISP or datacenter IPs and have one running in your browser within minutes.