HeaderDial › Guides

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 ruleServer receiveddocument.cookie
Nonejar=1jar=1
set fixed=abcfixed=abc (real cookie gone)jar=1
append extra=2jar=1; extra=2jar=1
removeno Cookie headerjar=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:

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 ruleStored by the browser
None, server sends r=1; Path=/r=1
remove Set-Cookienothing
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.

Since version 0.4.0 you don't have to write the header yourself. Click + Cookie, type a name and a value, and pick:

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:

RowsResult, both browsers
Send hd=1, Send dup=extServer 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

  1. Click the HeaderDial icon. If the site-access banner appears, choose Allow on all sites or Only <current host>.
  2. 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 more name=value pairs separated by ; .
  3. For responses: create a second profile with +, click + Response header and type Set-Cookie. Use remove, or set with a full cookie line such as theme=dark; Path=/; Max-Age=3600.
  4. 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.
  5. 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

A response set rule writes your cookie from every matching response, not just one. In our test it was stored from page loads too. Scope it tightly, and delete the cookie in DevTools when you are done; switching the rule off does not remove it.

To strip other headers the same way, see how to remove a request header.

Add to ChromeFirefox: coming soon