Proxy Authentication: Username/Password vs IP Whitelisting

How proxy authentication works: HTTP 407 and SOCKS5 passwords versus IP allowlisting, the security trade-offs, and how to rotate credentials without surprises.

Summarize this post with AI

A 15-minute read, or the key points in about 30 seconds, in the assistant you already use.

Opens in a new tab with the prompt filled in. Nothing passes through this site.

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.

Editorial cover showing two lanes into a proxy gateway: username and password login on one side, IP whitelist on the other

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.

Infographic of username and password proxy authentication on HTTP 407 and SOCKS5 handshake, showing that credentials go to the proxy, not the destination site, with a callout that Basic encoding is not encryption
The website never needs these credentials. Basic encoding is also not encryption, so the path to the proxy still has to be protected.

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.

Infographic of IP allowlist proxy authentication: only approved source addresses connect, stable VPS or office IPs work well, roaming and CI IPs break or over-admit through shared NAT
An allowlist is only as tight as the address you put on it. A shared or changing IP makes it a poor password substitute.

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.

QuestionUsername and passwordIP allowlist
Works from changing IPsYesNo, unless you update the list
Secret to store in the clientYes, the passwordNo password, but the list is still an access rule
Risk if it leaksAnyone with the password can use your traffic quotaAnyone who can leave from that IP can use the proxy
Best fitLaptops, CI, roaming, multiple staff machinesA stable server or office gateway
Weak fitShared passwords in chat or a public repoHome 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.
Comparison infographic of proxy username-password versus IP allowlisting, with rows for roaming, secret storage, leak impact and Best for, plus a takeaway to combine both on a stable server
Passwords travel well. Allowlists stay tight on a stable address. On a server, using both is stronger than either one alone.

Frequently asked questions

Does the website see my proxy username?▾
No, not in the normal HTTP or SOCKS path. Proxy credentials are consumed by the proxy. The destination sees the proxy's request, not your Proxy-Authorization header. That is not an excuse to reuse the same password on the website itself.
Is Basic authentication safe enough?▾
Basic only encodes the username and password, it does not encrypt them. Use it on a TLS path to the proxy, or on a network you already trust, and treat a log line that contains the header as a leaked password. If your provider offers a stronger scheme, prefer it.
Why did my allowlisted proxy stop working after I moved house?▾
Your public IP probably changed. Update the allowlist, or switch that client to username and password authentication. This is the usual failure mode of allowlisting on a home ISP, not a sign that the proxy product is "down".
Can I use both methods at once?▾
Often yes, and I would when the client is a stable server. The allowlist narrows who can even start a handshake, and the password still has to match. Ask your provider how they combine the two, because the exact rule is product-specific.
What should I put in a rotating username?▾
Only what the provider documents: account id, session name, country, and similar flags. Guessing a syntax is a good way to open a session you didn't want, or to send the password in the wrong field. After you set it, test the exit IP and the session behaviour. Setup steps for the client itself are in [how to set up a proxy](/blog/how-to-set-up-a-proxy)
Does authentication hide me from the destination site?▾
No. Authentication is how you log into the proxy. Hiding, or not hiding, your address from the destination is a function of the proxy path itself, and of leaks such as DNS or WebRTC. Get the auth right first, then test the path, including the [DNS leak](/blog/what-is-a-dns-leak) check most people skip.

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.

Share