Proxy authentication is the check a proxy server runs to confirm that a client is allowed to use it before it forwards any traffic. Proxy providers use two methods: a username and password sent with each connection, or IP whitelisting, where the proxy accepts connections only from IP addresses you registered in advance.
| Username and password | IP whitelisting | |
|---|---|---|
| How the proxy checks you | Credentials in the Proxy-Authorization header (HTTP) or the SOCKS5 login step | The source IP address of your connection is on your approved list |
| What you configure | The credentials in your proxy URL or tool settings | Each machine's public IP address in the provider's dashboard |
| Works when your IP address changes | Yes | No, each new IP address has to be added |
| Secrets in your code | Yes, so store them as environment variables or secrets | None |
| Main risk | Leaked credentials let anyone use your proxies | Anyone sharing your public IP address can use your proxies |
| Good fit | Cloud jobs, autoscaling servers, laptops, many users | Fixed servers and tools with no field for proxy credentials |
How does proxy authentication work?
Proxy authentication over HTTP works as a challenge and response: the proxy server refuses an unauthenticated request with status 407, and the client sends the request again with credentials.
- The client sends a request to the proxy without credentials.
- The proxy answers
407 Proxy Authentication Requiredwith aProxy-Authenticateheader that names the scheme it accepts, usually Basic. - The client repeats the request with a
Proxy-Authorizationheader that carries the credentials. - The proxy checks the credentials and forwards the request, or answers 407 again if they're wrong.
This is the exchange we captured from a test proxy in November 2026:
HTTP/1.1 407 Proxy Authentication Required
Proxy-Authenticate: Basic
GET http://127.0.0.1:3000/ HTTP/1.1
Proxy-Authorization: Basic dXNlcjE6cGFzczEyMw==The Basic scheme encodes username:password in base64 (dXNlcjE6cGFzczEyMw== decodes to user1:pass123). MDN points out that base64 is the same as sending credentials in clear text, because anyone who reads the header can decode it. The Proxy-Authorization header is meant for the next proxy on the path: Fastly's header reference notes that the first proxy that asked for credentials consumes it, so the website never receives your proxy password.
How does username and password proxy authentication work?
Username and password proxy authentication works by adding your proxy credentials to every connection, most often inside the proxy URL in the form http://username:password@host:port. HTTP clients, scraping libraries and browsers read the credentials from that URL and send them in the Proxy-Authorization header when the proxy asks.
Credentials travel with the request, not with the machine, so the same proxy login works from a laptop, a cloud function or a fleet of servers whose IP addresses change every deploy. Many providers also read options such as a target country or a session ID from the login, so check your provider's docs for the exact format.
On Rayobyte, the username, password, host and port are in the dashboard under Proxy Access, and the port is 8000. Each product has its own username suffix, such as -dc for Premium Rotating Datacenter or _scale for Scale Residential, and targeting options go at the end of the password rather than the username, as the authentication docs explain.
How does IP whitelisting work?
IP whitelisting works by checking the source IP address of each incoming connection against a list of addresses you approved in your provider's dashboard. A connection from a listed address is accepted with no credentials, and a connection from any other address is refused.
IP whitelisting keeps secrets out of your code and works with tools that have no field for proxy credentials. It depends on a stable public IP address, though. Home connections, mobile networks, VPNs and serverless platforms can change your public IP address without warning, and every machine behind the same office or cloud NAT gateway shares one public address, so all of them get access.
On Rayobyte, IP whitelisting is set up in the dashboard under Proxy Access, then IP Authorization. Requests from a whitelisted address send no credentials, so targeting moves into request headers such as X-Rayobyte-Country: US. Each product uses one method or the other, and Scale logins support only a username and password.
Username and password vs IP whitelisting: which should you use?
Username and password authentication suits most setups because it keeps working when your IP address changes, while IP whitelisting suits fixed servers that never move. Use these rules of thumb:
- Choose username and password for cloud functions, containers, autoscaling groups, laptops, and teams where each person or project needs its own login.
- Choose IP whitelisting for a dedicated server with a static IP address, or a tool that can't send proxy credentials.
- Store credentials as secrets, not in source code, and rotate them if they leak.
- Review your whitelist when you change hosting, office networks or VPNs, and remove addresses you no longer use.
How do SOCKS5 proxies authenticate?
SOCKS5 proxies authenticate during the connection handshake, before any traffic flows, rather than with HTTP headers. The client lists the methods it supports and the server picks one. RFC 1928 (March 1996) defines the method codes:
| Code | Method |
|---|---|
| X'00' | No authentication required |
| X'01' | GSSAPI |
| X'02' | Username and password |
| X'FF' | No acceptable methods |
The username and password method is defined in RFC 1929 (March 1996). Usernames and passwords can each be up to 255 bytes, and the RFC warns that the password travels in cleartext. A SOCKS5 proxy that uses IP whitelisting simply answers with method X'00' to approved addresses. Our guide to SOCKS5 proxies covers the protocol in more depth.
How do you use an authenticated proxy in curl and Python?
You use an authenticated proxy in curl and Python by putting the credentials in the proxy URL or passing them as a separate option. In curl, use -x with the credentials in the URL, or --proxy-user:
curl -x http://user1:[email protected]:8000 https://checkip.amazonaws.com
curl -x http://proxy.example.com:8000 --proxy-user user1:pass123 https://checkip.amazonaws.comIn Python, the requests library takes the same URL in its proxies dictionary. The response shows the IP address the website sees, which should be the proxy's:
import os
import requests
proxy = f"http://{os.environ['PROXY_USER']}:{os.environ['PROXY_PASS']}@proxy.example.com:8000"
proxies = {"http": proxy, "https": proxy}
r = requests.get("https://checkip.amazonaws.com", proxies=proxies, timeout=10)
print(r.status_code, r.text.strip())We tested both in November 2026 against a local proxy.py 2.4.10 server with Basic authentication and a local test page: requests with no credentials or a wrong password got 407, and requests with the right credentials got 200. With IP whitelisting, drop the user:pass@ part and use http://host:port.
Why does proxy authentication fail?
Proxy authentication fails most often because the credentials don't reach the proxy in the form it expects, or because your IP address is no longer on the whitelist. Check these first:
- Special characters in the password: an
@or:in a password breaks the proxy URL. Percent-encode them (@becomes%40,:becomes%3A) or pass the password with--proxy-user. In our test, a password with@failed in the URL and worked once encoded. - Wrong method: the account expects IP whitelisting but the client sends credentials, or the reverse.
- Changed public IP address: a new ISP address, VPN or cloud host means the whitelist no longer matches.
- Wrong port or protocol: an HTTP client pointed at a SOCKS5 port, or the reverse, fails before authentication starts, as our guide to proxy ports explains.
For more fixes, see our guides to proxy errors and proxies that stop working.
Whichever method you pick, test it against your own setup before you scale up. Rayobyte's rotating proxies and residential proxies start with a free trial.