curl -H adds or replaces an HTTP request header
Answer: curl -H or --header lets you add a header to the request. When used in an HTTP request, that header is added to the regular request headers. All headers set by curl itself can be replaced by the user. Like this: curl -H "Empty;" http://example.com
Notes
Pass -H more than once to set several headers. The man page describes --header as an extra header to include in information sent.
See also
Claims
- id: C1 claim: All headers set by curl itself can be replaced by the user. source: S1 evidence: "All headers set by curl itself can be replaced, by the user."
- id: C2 claim: An empty header can be sent with a trailing semicolon. source: S1 evidence: "curl -H \"Empty;\" http://example.com"
- id: C3 claim: --header adds an extra header to include in information sent. source: S2 evidence: "Extra header to include in information sent."
- id: C4 claim: On an HTTP request, the header is added to the regular request headers. source: S2 evidence: "When used within an HTTP request, it is added to the regular request headers."
Sources
- [S1] Customize headers. Everything curl. https://everything.curl.dev/http/modify/headers.html . License: CC-BY-4.0. Accessed 2026-11-23.
- [S2] --header. curl/curl (GitHub). https://github.com/curl/curl/blob/master/docs/cmdline-opts/header.md . License: curl license (MIT-derived). Accessed 2026-11-23.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Everything curl, Customize headers; curl/curl (GitHub), --header. CC-BY-4.0 (https://raw.githubusercontent.com/curl/everything-curl/master/LICENSE). Copyright the everything curl authors. curl license (MIT-derived) (https://raw.githubusercontent.com/curl/curl/master/COPYING). Copyright (c) 1996 - 2026, Daniel Stenberg, and many contributors. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Everything curl, Customize headers; curl/curl (GitHub), --header. CC-BY-4.0 (https://raw.githubusercontent.com/curl/everything-curl/master/LICENSE). Copyright the everything curl authors. curl license (MIT-derived) (https://raw.githubusercontent.com/curl/curl/master/COPYING). Copyright (c) 1996 - 2026, Daniel Stenberg, and many contributors.
Cite this
iinventedlight. 2026. "curl -H adds or replaces an HTTP request header." iinventedlight Library, iil:note:848en12t, version of 2026-11-23. https://iinventedlight.com/library/notes/curl-custom-headers/. License: CC-BY-4.0.
@misc{iil_note_848en12t,
author = {{iinventedlight}},
title = {{curl -H adds or replaces an HTTP request header}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-23},
url = {https://iinventedlight.com/library/notes/curl-custom-headers/},
note = {Permanent ID iil:note:848en12t. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- curl-custom-headers.schema.json (schema; CC-BY-4.0)
- curl-custom-headers.table.json (table; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/curl-custom-headers.md.