← All notes

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

Sources

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

Permanent ID: iil:note:848en12t

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.},
}

Markdown

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.

All artifact files (JSON index)

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.