Convert a curl command to browser headers
A request works in curl, or in DevTools' Copy as cURL, and you want your browser to send the same Authorization and custom headers on every request to that API. Paste the command below. The page lists its headers and cookies, unticks the ones your browser sends by itself, and turns the rest into a HeaderDial profile limited to the request's host. It reads the text in this page: nothing you paste is sent anywhere, and the page makes no network requests after it has loaded.
Read locally. Nothing you paste leaves this tab.
| Use | Name | Value |
|---|
The same import is built into HeaderDial 0.8.0 and later: click Import… in the popup and paste the command there.
Get the command from your browser
- Chrome and Edge: open DevTools (F12), go to the Network panel and make the request (reload the page or click the button that calls the API). Right-click the request, then Copy › Copy as cURL (bash). On Windows the (cmd) variant also works here.
- Firefox: in the Network panel, right-click the request, then Copy Value › Copy as cURL. On Windows, pick the POSIX variant if you are offered two.
- Also accepted: Copy as fetch from either browser, the request headers as
Name: valuelines (DevTools' raw view, including HTTP/2 lines like:authority:), a JSON object of headers, and a hand-writtencurlcommand.
Why most of the headers are unticked
A command copied from a browser carries everything the browser sent, and most of that it will send again on its own. Fixing those values for every request would change every page you load on that host. The page treats the text as a browser copy when it has a sec-fetch-* or sec-ch-ua* header, or when it is a DevTools fetch() copy.
| Header | Default | Why |
|---|---|---|
authorization, x-… and other custom headers | ticked | These are usually what the server checks, and what you want to send. |
accept, accept-language, user-agent, referer, origin, cache-control | unticked in a browser copy | Your browser already sends its own, with the right value for each request. In a hand-written curl command they stay ticked: you typed them on purpose. |
sec-fetch-*, sec-ch-ua*, host, connection, content-length, accept-encoding, priority | unticked | The browser sets these itself, and some of them an extension cannot change at all. See headers browsers won't let you change. |
cookies (-b or cookie:) | unticked in a browser copy | The browser already sends its own cookies for that site. Each cookie gets its own row. Tick one to send a fixed value with HeaderDial's cookie rows; see send a cookie without setting it. |
content-type, if-none-match, if-modified-since, range | unticked | They describe that one request (its body, or the cached copy it asked about), not every request. |
If a header appears twice, only the last copy is ticked. -H 'X-Name:' with nothing after the colon tells curl not to send that header, so it becomes a remove row. -H 'X-Name;' sends the header with an empty value.
What -u and --oauth2-bearer become
-u user:passwordbecomesAuthorization: Basicfollowed by the base64 ofuser:password, which is what curl sends. With-u userand no password, curl would ask for one; here it is encoded with an empty password, so edit the value in HeaderDial. More in Basic auth without the login prompt.--oauth2-bearer TOKENbecomesAuthorization: Bearer TOKEN.-AbecomesUser-Agentand-ebecomesReferer.-bwith a file name instead ofname=valueis skipped, with a note.
What a profile does not include
A profile changes headers on requests your pages make. It does not send requests of its own, so the method (-X POST), the body (-d, --data-raw, --json, -F) and the URL's path and query are left out, with a note when there was a body. To replay the request itself, run the curl command, or use Firefox's Edit and Resend in the Network panel.
Keep the token on one site
Without a filter, a profile applies to every request the browser makes: your Authorization header would go to every site you open, including analytics and CDN hosts. Only on <host> adds a Domain filter with the host from the command's URL. It matches that host and its subdomains, so api.example.com also covers eu.api.example.com, but not example.com or app.example.com. For more ways to scope a profile, see headers only on requests made by one site.
Tokens copied from DevTools often expire within an hour. In HeaderDial, set the expiry select on the Authorization row (15 min, 1 hour, 8 hours or 1 day) so it stops being sent when the token is dead anyway. See add an Authorization header.
Import it into HeaderDial
- Click Copy share link and open the link. The share page shows the profile; the profile is in the link after the
#, which browsers do not send to the server. - Copy the share page's address, open HeaderDial, click Import…, paste it and click Import.
- Or click Download JSON and choose the file in the same Import… dialog.
With HeaderDial 0.8.0 and later you can skip this page: paste the curl command straight into Import…, which shows the same list with the same ticks.
Add to ChromeFirefox: coming soon