header.d 2.0 KB

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