HTTP vs SOCKS5 proxies, explained

How each protocol works, where DNS lookups happen, and which proxy scheme to write in each tool.

By DINPROXY Team · · 4 min read

On this page

HTTP and SOCKS5 are two ways for your software to talk to a proxy. On DINPROXY both run on the same address, port and sign-in, so the choice comes down to what your tool supports. Here is how each protocol works, where DNS lookups happen, and which scheme to write in browsers, cURL, Python and Node.js.

How an HTTP proxy handles requests

An HTTP proxy speaks the language of the web. For a plain http:// site, your client sends the whole request to the proxy, which fetches the page from its exit IP and passes the answer back.

For an https:// site, your client first sends a CONNECT request that asks the proxy to open a tunnel to the site. Everything after that is encrypted between your client and the site, so we never see the page contents. That is why one setting covers both kinds of sites: use http:// as the proxy scheme for HTTP and HTTPS sites alike.

Your proxy user travels in a Proxy-Authorization header. Most HTTP clients add it for you when you put the username and password in the proxy URL or in a separate sign-in setting.

How SOCKS5 works

SOCKS5 works one level lower. Your client opens a connection to the proxy, signs in with a username and password, and asks the proxy to connect to a host and port. From then on, the proxy passes bytes in both directions without reading them.

The request inside looks just as it would without a proxy, and for HTTPS sites the encryption still runs from your client to the site. Because the sign-in comes first on every connection, the username and its options always arrive with the first request.

On DINPROXY, SOCKS5 uses the same host, port, username and password as HTTP: proxy.dinproxy.com on port 7777 for residential proxies and port 7779 for mobile proxies. You switch protocols by changing the scheme and nothing else.

Where the site's name is looked up

Before a connection opens, a name like example.com has to become an IP address. With an HTTP proxy, your client hands the name to the proxy, and the proxy does the lookup.

SOCKS5 lets the client choose. With socks5h:// (SOCKS5 with remote DNS), the client sends the name and the proxy looks it up. With plain socks5://, cURL, Python requests and many other clients look the name up on your own machine and send only the address.

Use socks5h:// for SOCKS5. The lookup then happens on the proxy side, just as it does with http://, and your local network stays out of it. The one exception is .NET: there you write socks5://, and the proxy still looks up the site's name.

HTTP and SOCKS5 side by side

HTTPSOCKS5
Scheme to writehttp://socks5h:// (socks5:// in .NET)
Sites it carriesHTTP and HTTPSHTTP and HTTPS
Addressproxy.dinproxy.com, port 7777 or 7779The same
Sign-inProxy user and password, or a whitelisted IPThe same
Name lookupOn the proxyOn the proxy
Rotating sessionNew IP per plain HTTP request; an HTTPS tunnel keeps its IP until it closesOne IP per connection until it closes
TargetsPublic sites on ports 80 and 443The same

Rotation follows the connection. In a rotating session, every plain HTTP request gets a new IP, even when your client reuses the connection. An HTTPS tunnel or a SOCKS5 connection keeps its IP until it closes. To keep one IP across many connections, add a session ID to the username; rotating vs sticky residential proxies explains when each fits.

Open connections count the same way for both protocols. Each account can keep up to 100 connections open at once, residential and mobile together. Reuse HTTPS and SOCKS5 connections with keep-alive, and close the ones you no longer need.

Which one to use in each tool

Both protocols use the same address, sign-in and options, so pick the one your tool handles best:

  • Browsers: set DINPROXY as an HTTP proxy and sign in with your proxy user. A browser keeps connections open, so add a session ID when a whole visit should come from one IP. On an iPhone, the dashboard's QR code adds the proxy to Shadowrocket as an HTTP server.
  • cURL: both work with --proxy and --proxy-user. Use http:// for a first test: the proxy's HTTP answers carry a status code and a short reason.
  • Python: write http:// in the proxies= dictionary of requests. For SOCKS5, install requests[socks] and write socks5h://. Our Python requests guide has copy-ready code.
  • Node.js: use https-proxy-agent with an http:// URL, or socks-proxy-agent with a socks5h:// URL.
  • Java and .NET: in Java, use HTTP and set the sign-in in a Proxy-Authorization header so it travels with the first request. In .NET, use SOCKS5 with socks5://, which sends the username at once. Both are in the code examples.
  • Tools without a password field: add the machine's public IP to your IP whitelist and connect with no sign-in. SOCKS5 clients that offer no authentication work the same way.

The same request over both protocols

Each example sends one request over HTTP and one over SOCKS5, and prints the IP address the site sees. Replace USERNAME and PASSWORD with a proxy user from Tools → Users in the dashboard, using the full connection username, such as 1024~myuser.

import axios from "axios";import { HttpsProxyAgent } from "https-proxy-agent";import { SocksProxyAgent } from "socks-proxy-agent";
const auth = `${encodeURIComponent("USERNAME")}:${encodeURIComponent("PASSWORD")}`;const agents = [  new HttpsProxyAgent(`http://${auth}@proxy.dinproxy.com:7777`),  new SocksProxyAgent(`socks5h://${auth}@proxy.dinproxy.com:7777`),];
for (const agent of agents) {  const response = await axios.get("https://ipinfo.io/ip", { httpAgent: agent, httpsAgent: agent });  console.log(response.data);}

Inside a proxy URL, characters such as @ in the username must be percent-encoded (@ becomes %40), which is why the Node.js and Python examples encode the sign-in. This matters as soon as you add options such as @country=us. The dashboard's User:Pass@IP:Port format is already encoded: add http:// or socks5h:// in front. Every setting is listed on the Connect & sign in page.

Both protocols work on Rotating Residential Proxies and Mobile Proxies, with the same proxy users and the same whitelist. Pick the one your tools handle best, and switch at any time by changing the scheme.

Frequently asked questions

Use http:// for both HTTP and HTTPS sites. For HTTPS sites your client opens an encrypted tunnel through the proxy, so the page contents stay between you and the site.

With socks5h://, the proxy looks up the site's name (remote DNS), so use it for SOCKS5 in cURL, Python and most tools. In .NET, write socks5://; the proxy still looks up the name there.

No. Both run on proxy.dinproxy.com with the same proxy user and password: port 7777 for residential proxies and 7779 for mobile proxies.

Keep reading