{"id":20710119,"url":"https://github.com/oxylabs/http-headers-with-curl","last_synced_at":"2026-06-01T00:32:15.652Z","repository":{"id":234419806,"uuid":"651122301","full_name":"oxylabs/http-headers-with-curl","owner":"oxylabs","description":"The basic actions of sending and receiving HTTP headers using cURL.","archived":false,"fork":false,"pushed_at":"2025-02-11T13:05:11.000Z","size":155,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-11T05:49:03.672Z","etag":null,"topics":["curl","http","http-headers","http-requests"],"latest_commit_sha":null,"homepage":"https://oxylabs.io/blog/curl-send-headers","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oxylabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-06-08T14:41:55.000Z","updated_at":"2025-02-11T13:05:15.000Z","dependencies_parsed_at":"2024-04-19T09:32:12.561Z","dependency_job_id":"3e27972d-ffad-42c2-a6f6-7368c4ad08ba","html_url":"https://github.com/oxylabs/http-headers-with-curl","commit_stats":null,"previous_names":["oxylabs/http-headers-with-curl"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/oxylabs/http-headers-with-curl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxylabs%2Fhttp-headers-with-curl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxylabs%2Fhttp-headers-with-curl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxylabs%2Fhttp-headers-with-curl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxylabs%2Fhttp-headers-with-curl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oxylabs","download_url":"https://codeload.github.com/oxylabs/http-headers-with-curl/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxylabs%2Fhttp-headers-with-curl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27682103,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-12T02:00:06.775Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["curl","http","http-headers","http-requests"],"created_at":"2024-11-17T02:09:55.281Z","updated_at":"2025-12-12T11:35:31.001Z","avatar_url":"https://github.com/oxylabs.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sending HTTP Headers With cURL\n\n\n[![Oxylabs promo code](https://raw.githubusercontent.com/oxylabs/product-integrations/refs/heads/master/Affiliate-Universal-1090x275.png)](https://oxylabs.io/pages/gitoxy?utm_source=877\u0026utm_medium=affiliate\u0026groupid=877\u0026utm_content=http-headers-with-curl-github\u0026transaction_id=102f49063ab94276ae8f116d224b67)\n\n[![](https://dcbadge.limes.pink/api/server/Pds3gBmKMH?style=for-the-badge\u0026theme=discord)](https://discord.gg/Pds3gBmKMH) [![YouTube](https://img.shields.io/badge/YouTube-Oxylabs-red?style=for-the-badge\u0026logo=youtube\u0026logoColor=white)](https://www.youtube.com/@oxylabs)\n\n[\u003cimg src=\"https://img.shields.io/static/v1?label=\u0026message=Curl\u0026color=brightgreen\" /\u003e](https://github.com/topics/curl) [\u003cimg src=\"https://img.shields.io/static/v1?label=\u0026message=Headers\u0026color=important\" /\u003e](https://github.com/topics/headers)\n\n- [Sending HTTP headers](#sending-http-headers)\n- [Sending custom HTTP headers](#sending-custom-http-headers)\n- [Sending multiple headers](#sending-multiple-headers)\n- [Get/show HTTP headers](#getshow-http-headers)\n- [Advanced tips for working with cURL headers](#advanced-tips-for-working-with-curl-headers)\n- [FAQ](#faq)\n\nIn this guide, you’ll learn how to send and receive HTTP headers using cURL, a versatile command-line tool for transferring data with URL syntax.\n\n## Sending HTTP headers\n\nHTTP headers consist of a name-value pair, separated by a colon – `:`. The name identifies the type of information sent, while the value is the actual data.\n\nSome of the most common HTTP headers include User-Agent, Content-Type, Accept, and Cache-Control.\n\nWhen you send an HTTP request with cURL, it sends the following headers by default:\n\n- `Host: example.com`\n- `user-agent: curl/7.87.0`\n- `accept: */*`\n\nYou can change the value of these headers when sending a request.\n\nTo send HTTP headers with cURL, you can use the `-H` or `--header` option followed by the header name and value in the format `\"Header-Name: value\"`.\n\n```sh\ncurl -H \"User-Agent: MyCustomUserAgent\" http://httpbin.org/headers\n```\n\nIn the example below, a custom User-Agent header is sent as `\"MyCustomUserAgent\"` when requesting the http://httpbin.org/headers page.\n\n![Change the value of User-Agent](images/curl-useragent.png)\n\nThe http://httpbin.org/headers page is meant for testing as it returns a JSON file with all the headers it found in the request. Ignore the `X-Amzn` header that this site uses internally.\n\n## Sending custom HTTP headers\n\nTo send custom HTTP headers with cURL, use the `-H` option and provide the header name and value.\n\n```sh\ncurl -H \"Authorization: Bearer my-access-token\" http://httpbin.org/headers\n```\n\n## Sending multiple headers\n\nTo send multiple headers with cURL, you can use the `-H` option multiple times in the same command.\n\n```sh\ncurl -H \"User-Agent: MyCustomUserAgent\" -H \"Accept:application/json\" http://httpbin.org/headers\n```\n\n## Get/show HTTP headers\n\nTo view the response headers from a web server, you can use the `-I` or `--head` option with cURL.\n\n```sh\ncurl -I http://httpbin.org/headers\ncurl --head http://httpbin.org/headers\n```\n\nYou can also use the `-i` or `--include` option to show both the response headers and the content in the output.\n\n```sh\ncurl -i http://httpbin.org/headers\ncurl --include http://httpbin.org/headers\n```\n\n## Advanced tips for working with cURL headers\n\n### Sending empty headers\n\n```sh\ncurl -H \"User-Agent;\" http://httpbin.org/headers\n```\n\n### Removing headers\n\n```sh\ncurl -H \"User-Agent:\" http://httpbin.org/headers\n```\n\n![You can use a colon with no value to remove a header](images/delete-header.png)\n\n### Verbose mode\n\nIf you want to see more detailed information about the request and response, including the headers sent and received, you can use the `-v` or `--verbose` option.\n\n```sh\ncurl -v http://httpbin.org/headers\ncurl --verbose http://httpbin.org/headers\n```\n\n### Saving headers to a file\n\n```sh\ncurl -D headers.txt -o content.txt http://httpbin.org/headers\n```\n\n## FAQ\n\n### How to add headers in cURL?\n\n```sh\ncurl -H \"User-Agent: MyCustomUserAgent\" http://httpbin.org/headers\n```\n\n### Does cURL automatically add headers?\n\nYes, cURL automatically adds standard headers, such as User-Agent, Accept, and Host, based on the request type and other options. You can override or add custom headers using the `-H` command.\n\n### How to check HTTP headers in cURL?\n\nTo check HTTP headers in cURL, use the `-I` or `--head` option to only retrieve headers without the actual content.\n\n```sh\ncurl -I http://httpbin.org/headers\n```\n\nAlternatively, you can use the `-i` or `--include` option to show both the response headers and content in the output.\n\n```sh\ncurl -i http://httpbin.org/headers\n```\n\n### How to send empty headers with cURL?\n\n```sh\ncurl -H \"User-Agent;\" http://httpbin.org/headers\n```\n\n### How to remove a default header in cURL?\n\nTo remove a header that cURL adds by default, provide the header name followed by a colon without a value. For example, to remove the User-Agent header:\n\n```sh\ncurl -H \"User-Agent:\" http://httpbin.org/headers\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foxylabs%2Fhttp-headers-with-curl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foxylabs%2Fhttp-headers-with-curl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foxylabs%2Fhttp-headers-with-curl/lists"}