A proxy that anyone can use is not a proxy you want. Authentication is how the proxy decides that a connection is yours: a username and password, an allowed source IP, or both.
This guide explains how those two methods work, on HTTP and SOCKS5, and the security trade-offs of each, including how rotating credentials fit in. It will not help you bypass a site's access controls or a provider's terms. For the mechanics of pointing a browser or OS at a proxy, use my setup guide. This post is about how the proxy knows it's you.
Some links are affiliate links; they don't change your price.

What is proxy authentication?
Proxy authentication is the step where the proxy accepts or refuses your client before it forwards traffic. The destination site does not see this step, and it should not receive those credentials.
That last point is worth repeating. On an HTTP proxy, the credentials are for the proxy. They travel in proxy-specific headers, not in the Authorization header you might send to the website.
If this is your first time wiring one up, my beginner guide to proxy servers covers the role of the proxy itself. Authentication is only the door into that role.
The two methods you'll be offered by almost every provider are:
- A username and password, sent when the connection is opened or when the proxy asks for them.
- An IP allowlist, often still called IP whitelisting, where the proxy accepts connections that arrive from approved addresses and rejects the rest.
Many providers let you combine them. That's usually the stronger option when you can do it.
How does username and password authentication work?
On HTTP and HTTPS proxies, the documented status for "who are you?" is 407 Proxy Authentication Required. The proxy sends a Proxy-Authenticate challenge. The client retries with a Proxy-Authorization header.
The most common scheme is Basic, defined in RFC 7617: the client sends a Base64 encoding of username:password. Base64 is not encryption. Anyone who can see that request on the wire can recover the password.
The practical protection is to only send those credentials on a path you already trust, such as a TLS connection to the proxy, or a private network. Don't paste a Basic header into a ticket, a screenshot, or a log file.
On SOCKS5, authentication is negotiated during the handshake, before any destination request. RFC 1928 defines the method list: method 0x00 is no authentication, and method 0x02 is username and password, with RFC 1929 as the document for that method.
The username and password are each 1 to 255 bytes. The proxy picks a method from the list the client offered, or it refuses the connection.
In both protocols, the password is a secret the client must store. That's the convenience and the risk. You can connect from a laptop, a CI runner, or a new cafe network without updating a ticket first. You can also leak the secret through a committed config file, an environment dump, or a shared note.

Some providers put routing hints in the username, such as a country, a session name, or a flag that the exit IP should stay sticky for a while. The syntax is vendor-specific, so use their docs, not a guessed pattern. The idea is the same: the password (or a session suffix) identifies you, and the rest of the username asks for a behaviour.
If you rotate residential or ISP exits, those session hints are how you get a sticky IP without giving up username and password auth. For the product side of ISP ranges, I keep a dated comparison of ISP proxy providers.
How does IP allowlisting work?
IP allowlisting skips the password. The proxy looks at the source address of the incoming connection. If that address is on the list, the proxy accepts it. If it isn't, the HTTP proxy will typically answer 407, and a SOCKS5 proxy will refuse the handshake.
This is attractive when the client sits on a stable address: an office gateway, a production VPS, or a locked-down NAT that only you use. There is no password in the client config, so there's nothing to leak in a repo.
It gets fragile the moment your public IP moves.
- A home ISP can change your address after a router restart.
- Carrier-grade NAT can put you behind a shared address, which means the allowlist may also admit other customers of that NAT, or may stop working when the mapping changes.
- Laptops, GitHub-style CI, and serverless functions often get a new IP on every run. You would be updating the allowlist all day, or opening it too wide.
If you allowlist a Hostinger KVM VPS, the server's address is stable enough for this model, and it's one reason I like running scheduled jobs from a small VPS rather than from a laptop.

An allowlist is also not a complete identity. It proves the request came from a network you named, not that it came from a particular program or person on that network. Anyone who can run code on the allowed machine can use the proxy.
Username and password vs IP allowlisting: which should I use?
Use the method that matches how your client gets onto the internet, then add the other if your provider lets you.
| Question | Username and password | IP allowlist |
|---|---|---|
| Works from changing IPs | Yes | No, unless you update the list |
| Secret to store in the client | Yes, the password | No password, but the list is still an access rule |
| Risk if it leaks | Anyone with the password can use your traffic quota | Anyone who can leave from that IP can use the proxy |
| Best fit | Laptops, CI, roaming, multiple staff machines | A stable server or office gateway |
| Weak fit | Shared passwords in chat or a public repo | Home ISP, CGNAT, ephemeral cloud functions |
My default for a laptop or a mixed team is username and password, stored in a secret manager or the OS keychain, never in a git repo. My default for a single production server with a fixed address is an allowlist, ideally combined with a password so a second process on a neighbouring IP isn't enough.
If you're choosing a protocol as well as an auth method, SOCKS5 vs HTTP is the companion piece. The auth negotiation differs, but the operational choice between a password and an allowlist is the same.
How should I handle rotating credentials?
Rotating credentials means you change the password, or the session part of the username, on a schedule or after a leak, without changing the whole account.
Do this when a laptop is lost, when a CI secret may have been logged, or simply on a calendar if many people share access. How you rotate is provider-specific: some have a dashboard button, some want a new sub-user, some encode a session ID in the username and you just start using a new one.
A few habits that stay valid across vendors:
- Give each client its own sub-user or session identity, so you can revoke one laptop without resetting everyone.
- Store the secret in a vault or an environment variable, not in a screenshot of the dashboard.
- After a rotation, confirm old credentials fail, then confirm the new ones work, including a leak test if the job is privacy-sensitive.
- Don't log Proxy-Authorization headers or SOCKS passwords. Redact them at the client.

Frequently asked questions
Pick a password when the client moves. Pick an allowlist when the client sits still. Pick both when you can.
Then store the secret like a secret, and test a rejected login as carefully as you test a successful one.


