How to test with Cookie and Set-Cookie headers in the browser
To send a fixed cookie, add a request header Cookie in HeaderDial with a value such as session=test123 and the operation set. Matching requests then carry only that value. Choose remove to send no cookies, or append to add one to the real ones. None of these touch the browser's stored cookies or document.cookie. Response rules are different: removing or rewriting Set-Cookie does change what the browser stores, in both Chrome and Firefox.
Request rules change only what the server sees
We tested in November 2026 with HeaderDial 0.2.0, Chrome 159 and Firefox 158. The page had one cookie, jar=1, and a local server logged the Cookie header of both a page load and a fetch() call. Both browsers gave the same results:
| Request rule | Server received | document.cookie |
|---|---|---|
| None | jar=1 | jar=1 |
set fixed=abc | fixed=abc (real cookie gone) | jar=1 |
append extra=2 | jar=1; extra=2 | jar=1 |
| remove | no Cookie header | jar=1 |
After the rules were switched off, the next request carried jar=1 again. The rule never wrote fixed=abc into the jar, so scripts on the page, and the Application or Storage panel in DevTools, still show the real cookies.
This makes request rules good for:
- Logged-out views of a site without logging out: remove Cookie for one host.
- Switching sessions: one profile per test user, each with
setand that user's session cookie, toggled with the Active switches. - Feature or A/B cookies: append
variant=bwhile keeping the session.
But a page that reads its session from document.cookie in JavaScript still sees the real one.
Response rules change the cookie jar
Same set-up, with the server sending one Set-Cookie line, through both a page load and a fetch():
| Response rule | Stored by the browser |
|---|---|
None, server sends r=1; Path=/ | r=1 |
remove Set-Cookie | nothing |
set Set-Cookie to x=rewritten; Path=/ | x=rewritten only |
append x=added; Path=/ | both r=1 and x=added |
None, server sends h=secret; HttpOnly; Path=/ | h, hidden from document.cookie |
set to h=secret; Path=/ (HttpOnly dropped) | h, now visible in document.cookie |
So in both browsers, cookie storage follows the modified header. That is unlike Cache-Control, where Chrome's cache ignores response overrides. In every case, response.headers.get('set-cookie') in the page returned null: browsers never show Set-Cookie to scripts.
Uses: see how the site behaves when a cookie is refused (remove), try a different expiry, SameSite or Path before changing the server (set), or temporarily expose an HttpOnly cookie to your own debugging script. Our tests used plain cookies over HTTP. We did not test how the browser treats rewritten Secure, Domain or SameSite attributes.
One cookie by name: Cookie rows (HeaderDial 0.4.0)
Since version 0.4.0 you don't have to write the header yourself. Click + Cookie, type a name and a value, and pick:
- Send: adds
name=valueafter the cookies the browser already sends. The browser's jar is not touched. - Store: adds a
Set-Cookieline to matching responses, so the browser saves the cookie. The extra field holds its attributes (defaultPath=/; for examplePath=/; Max-Age=3600).
Measured with HeaderDial 0.4.0 in Chrome 159 and Firefox 158 (these checks run in the extension's automated tests). The page already had two cookies, pre=0 and dup=browser; two rows were added, hd=1 and dup=ext:
| Rows | Result, both browsers |
|---|---|
Send hd=1, Send dup=ext | Server received pre=0; dup=browser; hd=1; dup=ext on page loads and fetch() |
Same, on a fetch() with credentials: 'omit' (Chrome) | Server received hd=1; dup=ext: the browser's cookies were left out, the rows were still sent |
Store hd=1, Store dup=ext (two Set-Cookie lines on one response) | Both stored; dup=ext replaced dup=browser |
Note the duplicate: when the browser already has a cookie with the same name, Send does not replace it. The server receives both, the browser's first, and which one your framework reads depends on its cookie parser. To replace a cookie for real, use Store, or a Cookie header row with set. If a profile has both a Cookie header row and Send rows, HeaderDial folds the rows into that header, after its value.
ModHeader's request and response cookie lists import as Send and Store rows. To get the same request in a terminal, open the profile's ⋯ menu and choose Copy as curl…: Send rows become one -b argument.
Steps
- Click the HeaderDial icon. If the site-access banner appears, choose Allow on all sites or Only <current host>.
- For one cookie by name: click + Cookie and choose Send or Store (see above). For the whole header: click + Request header, type
Cookie(it is in the suggestions), and pick set, append or remove. A value holds one or morename=valuepairs separated by;. - For responses: create a second profile with +, click + Response header and type
Set-Cookie. Use remove, or set with a full cookie line such astheme=dark; Path=/; Max-Age=3600. - Open Where it applies and use + Only on… with type Domain. For a response rule, a URL pattern for the one endpoint that sets the cookie is safer.
- Reload, then compare the server log with DevTools: Application › Cookies in Chrome and Edge, Storage › Cookies in Firefox.
The curl equivalent
# send fixed cookies
curl -b "session=test123; variant=b" https://staging.example.com/
# see what the server tries to set
curl -si https://staging.example.com/login | grep -i '^set-cookie'
# keep a cookie jar between calls
curl -c jar.txt -b jar.txt https://staging.example.com/
Pitfalls
- set replaces every request cookie. Sessions, CSRF cookies and consent cookies all disappear from matching requests. Use append to add one.
- Session values are secrets. Use Share as link… with Leave header values empty ticked, and clear values before Export all if the file leaves your machine.
- Switch it off afterwards. Give rows an expiry such as 1 hour, or press Alt+Shift+D to pause everything.
To strip other headers the same way, see how to remove a request header.
Add to ChromeFirefox: coming soon