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