{"id":22374545,"url":"https://github.com/kevcui/beheader","last_synced_at":"2026-04-27T12:05:20.243Z","repository":{"id":132197904,"uuid":"304865197","full_name":"KevCui/beheader","owner":"KevCui","description":":haircut: Cut off unnecessary headers in a cURL request","archived":false,"fork":false,"pushed_at":"2020-10-17T14:09:07.000Z","size":4866,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T17:40:22.076Z","etag":null,"topics":["cli","curl","curl-commands","curl-utility","header-parser","pentest-tool","pentesting","pentesting-tools"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KevCui.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"publiccode":null,"codemeta":null}},"created_at":"2020-10-17T11:45:18.000Z","updated_at":"2025-01-05T22:45:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"d244d7f1-9e92-4c6c-aca1-a96fce2471bc","html_url":"https://github.com/KevCui/beheader","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/KevCui/beheader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KevCui%2Fbeheader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KevCui%2Fbeheader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KevCui%2Fbeheader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KevCui%2Fbeheader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KevCui","download_url":"https://codeload.github.com/KevCui/beheader/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KevCui%2Fbeheader/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32335353,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T23:26:28.701Z","status":"online","status_checked_at":"2026-04-27T02:00:06.769Z","response_time":128,"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":["cli","curl","curl-commands","curl-utility","header-parser","pentest-tool","pentesting","pentesting-tools"],"created_at":"2024-12-04T21:17:27.352Z","updated_at":"2026-04-27T12:05:20.235Z","avatar_url":"https://github.com/KevCui.png","language":"Python","funding_links":["https://www.buymeacoffee.com/kevcui"],"categories":[],"sub_categories":[],"readme":"# Beheader\n\n\u003e Cut off unnecessary headers in a cURL request\n\n\u003cimg src=\".github/demo/demo.gif\" align=\"center\"\u003e\n\n## Table of Contents\n\n- [Why I need it?](#why-i-need-it)\n- [Usage](#usage)\n  - [Workflow](#workflow)\n  - [Example](#example)\n- [How it works?](#how-it-works)\n\n## Why I need it?\n\nNot all the HTTP request headers impact the HTTP response: some are mandatory/innocent, some are redundant/guilty. If you want to get rid of the guilty ones, this script will do the beheading job and make cURL request look nice \u0026 clean.\n\n## Usage\n\n```\nusage: beheader.py curl [URL] [-X REQUEST] [-H HEADER] [-d DATA]\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -X REQUEST, --request REQUEST\n                        Request method\n  -H HEADER, --header HEADER\n                        Request headers\n  -d DATA, --data DATA, --data-raw DATA\n                        Request data\n```\n\n### Workflow\n\n- Get/Copy the cURL command line from browser or other app\n\n- Run script `./beheader.py \u003ccur_syntax\u003e` to generate a new cURL command line with the shrunk headers as a result.\n\n- The result is also saved in `\u003cunixtime\u003e.curl`. To run it, simply execute `bash \u003cunixtime\u003e.curl`.\n\n### Example\n\n- GET request:\n\n```bash\n$ ./beheader.py curl 'https://duckduckgo.com/js/spice/dictionary/hyphenation/test' \\\n  -H 'authority: duckduckgo.com' \\\n  -H 'accept: application/json, text/javascript, */*; q=0.01' \\\n  -H 'user-agent: AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36' \\\n  -H 'x-requested-with: XMLHttpRequest' \\\n  -H 'sec-fetch-site: same-origin' \\\n  -H 'sec-fetch-mode: cors' \\\n  -H 'sec-fetch-dest: empty' \\\n  -H 'referer: https://duckduckgo.com/' \\\n  -H 'accept-language: en-US,en;q=0.9' \\\n  --compressed\n\n[INFO] Header is not needed ¯\\_(ツ)_/¯\ncurl -X GET \"https://duckduckgo.com/js/spice/dictionary/hyphenation/test\" --compressed\n```\n\n- POST request\n\n```bash\n$ ./beheader.py curl 'https://ssc.33across.com/api/v1/hb' \\\n  -H 'authority: ssc.33across.com' \\\n  -H 'user-agent: AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36' \\\n  -H 'content-type: text/plain' \\\n  -H 'accept: */*' \\\n  -H 'origin: https://www.w3schools.com' \\\n  -H 'sec-fetch-site: cross-site' \\\n  -H 'sec-fetch-mode: cors' \\\n  -H 'sec-fetch-dest: empty' \\\n  -H 'referer: https://www.w3schools.com/tags/ref_httpmethods.asp' \\\n  -H 'accept-language: en-US,en;q=0.9' \\\n  --data-binary '{\"imp\":[{\"banner\":{\"format\":[{\"w\":728,\"h\":90},{\"w\":970,\"h\":90}],\"ext\":{\"ttx\":{\"viewability\":{\"amount\":100}}}},\"ext\":{\"ttx\":{\"prod\":\"siab\"}}}],\"site\":{\"id\":\"beuMI6FAar6QjTaKlId8sQ\",\"page\":\"https://www.w3schools.com/tags/ref_httpmethods.asp\"},\"id\":\"72a047f5071ac\",\"user\":{\"ext\":{\"consent\":\"CO7ZHtzO7ZHtzDlAkAENA7CsAP_AAH_AACiQG2Nf_X_fb3_j-_599_t0eY1f9_7_v20zjheds-8Nyd_X_L8X_2M7vB36pr4KuR4ku3bBAQdtHOncTQmR6IlVqTLsbk2Mr7NKJ7PEmlsbe2dYGH9_n9XT_ZKZ79_v___7________77______3_v7wNsAJMNS-AiyEsYCSaNKoUQIQriQ6AEAFFCMLRNYQErgp2VwEfoIGACA1ARgRAgxBRiyCAAAAAJKIgBADwQCIAiAQAAgBUgIQAEaAILACQMAgAFANCwAiiCECQgyOCo5RAgIkWignkjAEoudjCCEEAAA\"}},\"regs\":{\"ext\":{\"gdpr\":1,\"us_privacy\":\"1---\"}},\"ext\":{\"ttx\":{\"prebidStartedAt\":1602882648477,\"caller\":[{\"name\":\"prebidjs\",\"version\":\"3.27.1\"}]}},\"source\":{\"ext\":{\"schain\":{\"ver\":\"1.0\",\"complete\":1,\"nodes\":[{\"asi\":\"snigelweb.com\",\"sid\":\"7088\",\"domain\":\"w3schools.com\",\"hp\":1}]}}}}' \\\n  --compressed\n\n[INFO] Check Header combination: {'user-agent': 'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36', 'content-type': 'text/plain', 'accept': '*/*', 'origin': 'https://www.w3schools.com', 'sec-fetch-site': 'cross-site', 'sec-fetch-mode': 'cors', 'sec-fetch-dest': 'empty', 'referer': 'https://www.w3schools.com/tags/ref_httpmethods.asp', 'accept-language': 'en-US,en;q=0.9'}\n[INFO] Check Header combination: {'authority': 'ssc.33across.com', 'content-type': 'text/plain', 'accept': '*/*', 'origin': 'https://www.w3schools.com', 'sec-fetch-site': 'cross-site', 'sec-fetch-mode': 'cors', 'sec-fetch-dest': 'empty', 'referer': 'https://www.w3schools.com/tags/ref_httpmethods.asp', 'accept-language': 'en-US,en;q=0.9'}\n[INFO] Check Header combination: {'authority': 'ssc.33across.com', 'user-agent': 'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36', 'accept': '*/*', 'origin': 'https://www.w3schools.com', 'sec-fetch-site': 'cross-site', 'sec-fetch-mode': 'cors', 'sec-fetch-dest': 'empty', 'referer': 'https://www.w3schools.com/tags/ref_httpmethods.asp', 'accept-language': 'en-US,en;q=0.9'}\n[INFO] Check Header combination: {'authority': 'ssc.33across.com', 'user-agent': 'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36', 'content-type': 'text/plain', 'origin': 'https://www.w3schools.com', 'sec-fetch-site': 'cross-site', 'sec-fetch-mode': 'cors', 'sec-fetch-dest': 'empty', 'referer': 'https://www.w3schools.com/tags/ref_httpmethods.asp', 'accept-language': 'en-US,en;q=0.9'}\n[INFO] Check Header combination: {'authority': 'ssc.33across.com', 'user-agent': 'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36', 'content-type': 'text/plain', 'accept': '*/*', 'sec-fetch-site': 'cross-site', 'sec-fetch-mode': 'cors', 'sec-fetch-dest': 'empty', 'referer': 'https://www.w3schools.com/tags/ref_httpmethods.asp', 'accept-language': 'en-US,en;q=0.9'}\n[INFO] Check Header combination: {'authority': 'ssc.33across.com', 'user-agent': 'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36', 'content-type': 'text/plain', 'accept': '*/*', 'origin': 'https://www.w3schools.com', 'sec-fetch-mode': 'cors', 'sec-fetch-dest': 'empty', 'referer': 'https://www.w3schools.com/tags/ref_httpmethods.asp', 'accept-language': 'en-US,en;q=0.9'}\n[INFO] Check Header combination: {'authority': 'ssc.33across.com', 'user-agent': 'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36', 'content-type': 'text/plain', 'accept': '*/*', 'origin': 'https://www.w3schools.com', 'sec-fetch-site': 'cross-site', 'sec-fetch-dest': 'empty', 'referer': 'https://www.w3schools.com/tags/ref_httpmethods.asp', 'accept-language': 'en-US,en;q=0.9'}\n[INFO] Check Header combination: {'authority': 'ssc.33across.com', 'user-agent': 'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36', 'content-type': 'text/plain', 'accept': '*/*', 'origin': 'https://www.w3schools.com', 'sec-fetch-site': 'cross-site', 'sec-fetch-mode': 'cors', 'referer': 'https://www.w3schools.com/tags/ref_httpmethods.asp', 'accept-language': 'en-US,en;q=0.9'}\n[INFO] Check Header combination: {'authority': 'ssc.33across.com', 'user-agent': 'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36', 'content-type': 'text/plain', 'accept': '*/*', 'origin': 'https://www.w3schools.com', 'sec-fetch-site': 'cross-site', 'sec-fetch-mode': 'cors', 'sec-fetch-dest': 'empty', 'accept-language': 'en-US,en;q=0.9'}\n[INFO] Check Header combination: {'authority': 'ssc.33across.com', 'user-agent': 'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36', 'content-type': 'text/plain', 'accept': '*/*', 'origin': 'https://www.w3schools.com', 'sec-fetch-site': 'cross-site', 'sec-fetch-mode': 'cors', 'sec-fetch-dest': 'empty', 'referer': 'https://www.w3schools.com/tags/ref_httpmethods.asp'}\n[INFO] Must-have headers(s): content-type\ncurl -X POST \"https://ssc.33across.com/api/v1/hb\" -H 'content-type: text/plain' --data '{\"imp\":[{\"banner\":{\"format\":[{\"w\":728,\"h\":90},{\"w\":970,\"h\":90}],\"ext\":{\"ttx\":{\"viewability\":{\"amount\":100}}}},\"ext\":{\"ttx\":{\"prod\":\"siab\"}}}],\"site\":{\"id\":\"beuMI6FAar6QjTaKlId8sQ\",\"page\":\"https://www.w3schools.com/tags/ref_httpmethods.asp\"},\"id\":\"72a047f5071ac\",\"user\":{\"ext\":{\"consent\":\"CO7ZHtzO7ZHtzDlAkAENA7CsAP_AAH_AACiQG2Nf_X_fb3_j-_599_t0eY1f9_7_v20zjheds-8Nyd_X_L8X_2M7vB36pr4KuR4ku3bBAQdtHOncTQmR6IlVqTLsbk2Mr7NKJ7PEmlsbe2dYGH9_n9XT_ZKZ79_v___7________77______3_v7wNsAJMNS-AiyEsYCSaNKoUQIQriQ6AEAFFCMLRNYQErgp2VwEfoIGACA1ARgRAgxBRiyCAAAAAJKIgBADwQCIAiAQAAgBUgIQAEaAILACQMAgAFANCwAiiCECQgyOCo5RAgIkWignkjAEoudjCCEEAAA\"}},\"regs\":{\"ext\":{\"gdpr\":1,\"us_privacy\":\"1---\"}},\"ext\":{\"ttx\":{\"prebidStartedAt\":1602882648477,\"caller\":[{\"name\":\"prebidjs\",\"version\":\"3.27.1\"}]}},\"source\":{\"ext\":{\"schain\":{\"ver\":\"1.0\",\"complete\":1,\"nodes\":[{\"asi\":\"snigelweb.com\",\"sid\":\"7088\",\"domain\":\"w3schools.com\",\"hp\":1}]}}}}' --compressed\n```\n\n## How it works?\n\nFirst the script will run once with all provided headers to get the response status and the length of response content as the references. Then the scripts runs N times (N = number of total headers), each time has 1 header removed, to save all results. In the end, the script will check the results and compare them against reference status and length to determine if the certain header is necessary or not. If a header is removed, but the result is the same as the references, then this header is not necessary.\n\nBe aware that this script uses the status of the response and length of the response as the references, not checking the exact content of the response. In some cases, the response may contain dynamic contents causing the false detection.\n\n---\n\n\u003ca href=\"https://www.buymeacoffee.com/kevcui\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/v2/default-orange.png\" alt=\"Buy Me A Coffee\" height=\"60px\" width=\"217px\"\u003e\u003c/a\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevcui%2Fbeheader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkevcui%2Fbeheader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevcui%2Fbeheader/lists"}