Getting started

HTTP and SOCKS5: differences, DNS and when to use each

HTTP and SOCKS5 proxies compared: how each protocol works, what socks5 vs socks5h changes for DNS, which tools support what, and when to use which one.

3 min read Updated

On this page

Every FreshProxies plan works over HTTP and SOCKS5, both with username and password authentication. For most web work the choice makes little difference, but a few details, DNS above all, decide whether a setup behaves the way you expect.

How an HTTP proxy works

An HTTP proxy speaks the same protocol as the web.

  • For a plain http:// website, your client sends the full request to the proxy, and the proxy fetches the page.
  • For an https:// website, your client sends a CONNECT request naming the host and port. The proxy opens a tunnel, and your client runs TLS through it directly with the website.

In the HTTPS case, the proxy sees the hostname, the port and how much data passes, but not the pages, cookies or form data inside the tunnel.

How SOCKS5 works

SOCKS5 is a lower-level relay. After a short handshake and the username and password check, your client asks the proxy to connect to a host and port. From then on, the proxy passes bytes back and forth without reading them. It doesn't care whether the traffic is HTTP, HTTPS or another TCP protocol.

That makes SOCKS5 the choice for software that isn't a web client, or that only offers a SOCKS option.

Side by side

HTTP proxy SOCKS5 proxy
Works at The HTTP layer The TCP connection
Traffic Web traffic (HTTP and HTTPS) Any TCP protocol
HTTPS sites Through a CONNECT tunnel, encrypted end to end Through the relay, encrypted end to end
DNS Resolved by the proxy Resolved by the proxy or locally, depending on the client
Username and password in Chrome Supported Not supported
Support in tools Nearly universal Common, sometimes through an add-on package

socks5 vs socks5h: where DNS happens

Before connecting, something has to turn a domain name into an IP address. With SOCKS5, that can happen in two places:

  • socks5:// in many tools means your machine looks up the name and sends the proxy an IP address.
  • socks5h:// means your machine sends the name and the proxy looks it up.

Remote resolution, the h variant, is usually what you want:

  • Privacy: with local resolution, your own DNS resolver sees every domain you visit, even though the traffic goes through the proxy.
  • Location: many sites answer DNS lookups with servers near the resolver. Local resolution can send you to servers near you instead of near your exit country.
  • Reachability: some names resolve differently, or not at all, from your own network.

Tools don't all follow the same convention:

Client socks5:// socks5h://
curl Local DNS Proxy DNS
Python requests (with PySocks) Local DNS Proxy DNS
Python httpx 0.28 and newer Proxy DNS Proxy DNS
aiohttp with aiohttp-socks Proxy DNS with the rdns=True option Not needed; use socks5:// with rdns=True
Node.js socks-proxy-agent Local DNS Proxy DNS
Chrome Proxy DNS, but no password support Not accepted

To see what your setup does in practice, open the DNS leak test through the proxy.

When to use which

Use HTTP when:

  • you work with browsers, browser automation or HTTP libraries
  • you need username and password authentication in Chrome or in tools built on it
  • you aren't sure; it is the default for web work

Use SOCKS5 when:

  • the software only supports SOCKS, or isn't a web client
  • you want one proxy setting for several protocols

Speed usually differs little between the two. The exit IP and the route to the website matter far more than the protocol.

Credentials and encryption

Neither protocol encrypts the hop between you and the proxy. HTTP proxies receive your username and password in a Proxy-Authorization header that is base64-encoded, not encrypted, and SOCKS5 sends them as plain text in its handshake. What you send to HTTPS websites stays encrypted end to end in both cases. Plain http:// websites can be read along the way, with or without a proxy, so use HTTPS wherever a site offers it.

Use the right port

Your dashboard lists the port to use for each protocol. Pointing a SOCKS5 client at an HTTP port, or the other way round, fails with errors that look like network problems, such as a closed connection or a handshake error. If a connection fails right away, check the port first. Proxy formats shows how to write each scheme, and troubleshooting covers the error messages.