407 Proxy Authentication Required: Fix Guide
The 407 Proxy Authentication Required error means your request was routed through a proxy server that requires authentication, but valid credentials were not provided. This is a common issue when configuring proxies for web scraping, browser automation, or corporate network access. Here is how to diagnose and fix it.
What Does 407 Mean?
A 407 status code is the proxy equivalent of a 401 Unauthorized error. The proxy server sitting between your client and the target server is demanding credentials before it will forward your request. The response includes a Proxy-Authenticate header indicating the authentication method required.
HTTP/1.1 407 Proxy Authentication Required
Proxy-Authenticate: Basic realm="Proxy"
Common Causes
| Cause | Description |
|---|---|
| Missing proxy credentials | Username/password not included in the request |
| Wrong credentials | Typo in username or password |
| Expired credentials | Proxy subscription or trial expired |
| Wrong auth method | Using Basic auth when Digest is required |
| IP not whitelisted | Proxy requires IP whitelist + credentials |
| Proxy plan limits | Free tier or trial limitations |
How to Fix 407 Errors
Fix with cURL
# Method 1: Inline credentials with -x flag
curl -x http://username:password@proxy.example.com:8080 https://httpbin.org/ip
Method 2: Separate proxy and auth flags
curl -x http://proxy.example.com:8080 \
--proxy-user username:password \
https://httpbin.org/ip
Method 3: Using environment variables
export http_proxy="http://username:password@proxy.example.com:8080"
export https_proxy="http://username:password@proxy.example.com:8080"
curl https://httpbin.org/ip
Debug: See the full request/response exchange
curl -v -x http://proxy.example.com:8080 \
--proxy-user username:password \
https://httpbin.org/ip
Fix with Python Requests
import requests
proxies = {
"http": "http://username:password@proxy.example.com:8080",
"https": "http://username:password@proxy.example.com:8080",
}
response = requests.get("https://httpbin.org/ip", proxies=proxies)
print(response.json())
Fix with Python + SOCKS Proxy
pip install requests[socks]
import requests
proxies = {
"http": "socks5://username:password@proxy.example.com:1080",
"https": "socks5://username:password@proxy.example.com:1080",
}
response = requests.get("https://httpbin.org/ip", proxies=proxies)
print(response.json())
Fix in Browser Settings
Chrome:
- Go to Settings > System > Open proxy settings
- Enter proxy address, port, and credentials
- Or use a proxy extension like FoxyProxy or SwitchyOmega
Firefox:
- Settings > General > Network Settings > Settings
- Select “Manual proxy configuration”
- Enter proxy details and check “Use this proxy for HTTPS”
Authentication Methods
The Proxy-Authenticate header tells you which authentication scheme the proxy expects:
| Method | Header Value | How to Use |
|---|---|---|
| Basic | Basic realm="..." | Send base64-encoded username:password |
| Digest | Digest realm="..." | Challenge-response with hashed credentials |
| NTLM | NTLM | Windows domain authentication |
| Negotiate | Negotiate | Kerberos/SPNEGO |
Handling Digest Authentication
# cURL handles digest auth automatically with --proxy-user
curl -x http://proxy.example.com:8080 \
--proxy-user username:password \
--proxy-digest \
https://httpbin.org/ip
from requests.auth import HTTPDigestAuth
import requests
For proxy digest auth, encode in URL
proxies = {
"http": "http://username:password@proxy.example.com:8080",
"https": "http://username:password@proxy.example.com:8080",
}
response = requests.get("https://httpbin.org/ip", proxies=proxies)
print(response.status_code)
Troubleshooting Checklist
- Verify credentials — Log into your proxy provider’s dashboard and confirm username/password
- Check the proxy URL format — Ensure it is
http://user:pass@host:port - Special characters in password — URL-encode special characters (e.g.,
@becomes%40) - Check proxy plan status — Ensure your subscription is active and has remaining bandwidth
- IP whitelist — Some providers require you to whitelist your source IP in addition to credentials
- Test with a simple request — Try
curl -x http://user:pass@proxy:port https://httpbin.org/ip - Check firewall — Ensure your network allows outbound connections on the proxy port
URL-Encoding Special Characters
If your password contains special characters, encode them:
# Password: p@ss#word!
Encoded: p%40ss%23word%21
curl -x http://username:p%40ss%23word%21@proxy.example.com:8080 https://httpbin.org/ip
from urllib.parse import quote
password = "p@ss#word!"
encoded_password = quote(password, safe="")
proxy_url = f"http://username:{encoded_password}@proxy.example.com:8080"
proxies = {"http": proxy_url, "https": proxy_url}
407 vs 401
| Feature | 401 Unauthorized | 407 Proxy Auth Required |
|---|---|---|
| Who requires auth | Target server | Proxy server |
| Header returned | WWW-Authenticate | Proxy-Authenticate |
| Header to send | Authorization | Proxy-Authorization |
| Fix | Add server credentials | Add proxy credentials |
FAQ
Why do I get 407 when my proxy credentials are correct?
Check for special characters in your password that need URL-encoding. Also verify your IP is whitelisted if the proxy provider requires it.
Can I use a proxy without authentication?
Some free proxies and locally hosted proxies do not require authentication. However, most commercial proxy services require credentials for security and billing.
How do I fix 407 in a corporate network?
Contact your IT department for the correct proxy credentials. In Windows environments, NTLM or Kerberos authentication may be required, which is handled automatically by system-level proxy settings.
last updated: March 12, 2026