blob: 90af7359e64ad0d5e9253c3de84dc56d226c0aa7 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001Long: header
2Short: H
3Arg: <header>
4Help: Pass custom header LINE to server
5Protocols: HTTP
6---
7
8Extra header to include in the request when sending HTTP to a server. You may
9specify any number of extra headers. Note that if you should add a custom
10header that has the same name as one of the internal ones curl would use, your
11externally set header will be used instead of the internal one. This allows
12you to make even trickier stuff than curl would normally do. You should not
13replace internally set headers without knowing perfectly well what you're
14doing. Remove an internal header by giving a replacement without content on
15the right side of the colon, as in: -H \&"Host:". If you send the custom
16header with no-value then its header must be terminated with a semicolon, such
17as \-H \&"X-Custom-Header;" to send "X-Custom-Header:".
18
19curl will make sure that each header you add/replace is sent with the proper
20end-of-line marker, you should thus \fBnot\fP add that as a part of the header
21content: do not add newlines or carriage returns, they will only mess things up
22for you.
23
24See also the --user-agent and --referer options.
25
26Starting in 7.37.0, you need --proxy-header to send custom headers intended
27for a proxy.
28
29Example:
30
31 curl -H "X-First-Name: Joe" http://example.com/
32
33\fBWARNING\fP: headers set with this option will be set in all requests - even
34after redirects are followed, like when told with --location. This can lead to
35the header being sent to other hosts than the original host, so sensitive
36headers should be used with caution combined with following redirects.
37
38This option can be used multiple times to add/replace/remove multiple headers.