An HTTP cookie is a small name=value pair that a server sends in a Set-Cookie response header. The browser or client stores it and sends it back in the Cookie request header on later requests to the same site. That is how a stateless protocol remembers a login, a cart or a language choice.
We tested every step on 20 November 2026 with curl 8.21.0 and Python Requests 2.34.2, through QuanticData residential and mobile proxies: we created a cookie, stored it, sent it back from three different IPs, and read the real cookies of two large sites. Exit IPs are masked.
How a cookie works, in one round trip
- The server sets it. httpbin.org/cookies/set?session_id=demo42 answered with a redirect and this header:
set-cookie: session_id=demo42; Secure; Path=/. - The client stores it. A browser keeps it in its cookie store; curl keeps it in a cookie jar file when you pass
-c jar.txt. - The client sends it back. On the next request to the same site and path, the header
Cookie: session_id=demo42goes out with it (-b jar.txtin curl). - The server reads it and knows the request belongs to the same visitor or session.
curl -x http://USER:PASS@residentialboson.quanticdata.io:10000 -i -c jar.txt \
"https://httpbin.org/cookies/set?session_id=demo42"
HTTP/1.1 302 Found
location: /cookies
set-cookie: session_id=demo42; Secure; Path=/
type jar.txt
# Netscape HTTP Cookie File
httpbin.org FALSE / TRUE 0 session_id demo42
The jar line reads: site, subdomains, path, Secure, expiry (0 means a session cookie, gone when the client closes), name, value.
Real Set-Cookie lines from two large sites
Through a Residential Premium line in Germany, www.google.com set this cookie on a plain request for its home page:
Set-Cookie: AEC=...; expires=Wed, 19-May-2027 15:33:05 GMT; path=/; domain=.google.com; Secure; HttpOnly; SameSite=lax
Through a Residential Basic line in the US, www.wikipedia.org set four, among them:
set-cookie: WMF-Last-Access=20-Nov-2026;Path=/;HttpOnly;secure;Expires=Tue, 22 Dec 2026 12:00:00 GMT
set-cookie: GeoIP=US:AL:Mobile:...; Path=/; secure; Domain=.wikipedia.org
set-cookie: NetworkProbeLimit=0.001;Path=/;Secure;SameSite=None;Max-Age=3600
The GeoIP cookie is worth a look: Wikipedia stored where it placed our exit IP, Mobile, Alabama. A cookie can carry what a site concluded about your IP to every later request.
Cookie attributes, read from those lines
| Attribute | Seen on | What it does |
|---|---|---|
Expires / Max-Age | Google (19 May 2027), Wikipedia (Max-Age=3600, one hour) | When the cookie expires. Without either, it is a session cookie. |
Domain | .google.com, .wikipedia.org | Sends the cookie to subdomains too. Without it, only to the exact host. |
Path | / on all of them | Sends it for every path under the one given. |
Secure | All of them | Only over HTTPS. |
HttpOnly | Google AEC, Wikipedia WMF-Last-Access | Scripts in the page cannot read it, which limits cookie theft through injected code. |
SameSite | lax on Google, None on Wikipedia | Whether the cookie goes along on requests started from other sites. |
Cookies travel as ordinary headers, so everything in HTTP headers explained applies: Set-Cookie in responses, Cookie in requests.
Sending a cookie by hand
You do not need a jar to send a cookie you already have, for example one copied from your browser's developer tools. In curl, give -b the pairs themselves instead of a file name; several cookies go in one string, separated by semicolons. Through a Residential Premium line in Germany:
curl -x http://USER:PASS@residentialpremium.quanticdata.io:8080 \
-b "session_id=demo42; lang=de" https://httpbin.org/cookies
{
"cookies": {
"lang": "de",
"session_id": "demo42"
}
}
The server received both cookies in one Cookie header. Only the name and value travel back: attributes such as Secure or Expires stay with the client, which uses them to decide whether to send the cookie at all. A cookie copied from a logged-in browser carries that login, so treat it like a password.
Cookies and sessions in Python
In Python Requests, a Session is a cookie jar: it stores every Set-Cookie and sends the cookies back on the next call. We ran it through a mobile line:
import requests
s = requests.Session()
s.proxies = {"https": "http://USER:PASS@mobile.quanticdata.io:8080"}
s.get("https://httpbin.org/cookies/set?session_id=demo42", allow_redirects=False)
print(s.cookies.get_dict()) # {'session_id': 'demo42'}
r = s.get("https://httpbin.org/anything").json()
print(r["headers"]["Cookie"]) # session_id=demo42
Plain requests.get() calls do not share cookies; use a Session whenever a site sets one you need to keep. Proxy setup for Requests is in a proxy in Python Requests.
One cookie, three IPs: what the site sees
Here is the part that matters with proxies. We sent the same jar to httpbin.org/anything, which echoes the cookie and the IP it came from, three times:
| Request | Cookie the site received | IP the site saw |
|---|---|---|
| Same session name that set the cookie | session_id=demo42 | x.x.x.x |
| Residential Basic, new session ID | session_id=demo42 | x.x.x.x |
| Mobile line | session_id=demo42 | x.x.x.x |
To the site, that is one session arriving from three addresses within seconds. A site can ask a session that changes IP to log in again. The session name is a setting in the proxy username: use one session name per cookie jar, and start a fresh jar when you change it. For one IP kept for 30 days, use static residential proxies. When you want a new IP for every request, keep requests stateless and send no cookies; how to use rotating proxies covers that pattern.
Which proxy for cookie-based sessions
- Residential Basic and Premium: home IPs in the country you pick, with the session name and session time set in the username, for logins, carts and multi-page flows. See residential proxies.
- Mobile: carrier IPs with the same session settings, for sites and apps that expect phone traffic. See mobile proxies.
Cookies are one of the ways a site recognises a returning visitor; browser fingerprinting is another, and works without any cookie. To try it on a residential line, there is a Residential Basic free trial; the command-line options are in how to use a proxy with curl.


