{"id":77627,"date":"2025-07-22T09:42:32","date_gmt":"2025-07-22T08:42:32","guid":{"rendered":"https:\/\/proxidize.com\/?post_type=blog&#038;p=77627"},"modified":"2025-10-02T11:50:38","modified_gmt":"2025-10-02T10:50:38","slug":"curl-show-response-headers","status":"publish","type":"blog","link":"https:\/\/proxidize.com\/blog\/curl-show-response-headers\/","title":{"rendered":"How to Show Response Headers with cURL"},"content":{"rendered":"\n<p>As a developer when working with APIs, troubleshooting HTTP responses, or optimizing server performance, <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTTP\/Reference\/Headers\" target=\"_blank\" rel=\"noopener\">response headers<\/a> can tell you a lot from content type and caching rules to redirect info and rate limits. While browsers hide most of this behind DevTools, <strong>cURL gives you full, direct access from the command line<\/strong>.<\/p>\n\n\n\n<p>If you\u2019ve ever wondered how <strong>to view HTTP headers using <a href=\"https:\/\/curl.se\/\" target=\"_blank\" rel=\"noopener\">cURL<\/a><\/strong>, the good news is i<strong>t\u2019s just a matter of using the right flags<\/strong>. But which flags show headers only, which include the response body, and which let you debug both request and response?<\/p>\n\n\n\n<p>In this article, we\u2019ll break down the different ways to view response headers with cURL, how to save them, and when to use each approach whether you\u2019re debugging an API call or just checking if a CDN is doing its job.<\/p>\n\n\n\n<div style=\"height:24px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large is-resized centered\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"536\" src=\"https:\/\/proxidize.com\/wp-content\/uploads\/2025\/07\/how-to-get-headers-only-with-curl-1024x536.jpg\" alt=\"A drawing of a code box under the title &quot;How to Get Headers Only with cURL&quot;.\" class=\"wp-image-78026\" style=\"object-fit:cover\" srcset=\"https:\/\/proxidize.com\/wp-content\/uploads\/2025\/07\/how-to-get-headers-only-with-curl-1024x536.jpg 1024w, https:\/\/proxidize.com\/wp-content\/uploads\/2025\/07\/how-to-get-headers-only-with-curl-300x157.jpg 300w, https:\/\/proxidize.com\/wp-content\/uploads\/2025\/07\/how-to-get-headers-only-with-curl-768x402.jpg 768w, https:\/\/proxidize.com\/wp-content\/uploads\/2025\/07\/how-to-get-headers-only-with-curl-600x314.jpg 600w, https:\/\/proxidize.com\/wp-content\/uploads\/2025\/07\/how-to-get-headers-only-with-curl.jpg 1200w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<div style=\"height:24px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">How to Get Headers Only with cURL<\/h2>\n\n\n\n<p>The simplest way to view HTTP response headers using cURL is by using the <a href=\"https:\/\/curl.se\/docs\/manpage.html#-I\" target=\"_blank\" rel=\"noopener\">-I flag<\/a> (also written as <code>--head<\/code>). This tells cURL to send a <code>HEAD<\/code> request, which asks the server to respond with headers only no body content.<\/p>\n\n\n\n<p><strong>Example:<\/strong><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.75rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#e0def4;--cbp-line-number-width:calc(1 * 0.6 * .75rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e0def4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>curl -I https:\/\/example.com<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki rose-pine-moon\" style=\"background-color: #232136\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #EA9A97\">curl<\/span><span style=\"color: #E0DEF4\"> <\/span><span style=\"color: #3E8FB0\">-I<\/span><span style=\"color: #E0DEF4\"> <\/span><span style=\"color: #F6C177\">https:\/\/example.com<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<div style=\"height:12px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>This command will return output like:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.75rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#e0def4;--cbp-line-number-width:calc(1 * 0.6 * .75rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e0def4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>HTTP\/2 200\ndate: Tue, 02 Jul 2024 10:00:00 GMT\ncontent-type: text\/html; charset=UTF-8\nserver: nginx\ncache-control: max-age=3600<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki rose-pine-moon\" style=\"background-color: #232136\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #e0def4\">HTTP\/2 200<\/span><\/span>\n<span class=\"line\"><span style=\"color: #e0def4\">date: Tue, 02 Jul 2024 10:00:00 GMT<\/span><\/span>\n<span class=\"line\"><span style=\"color: #e0def4\">content-type: text\/html; charset=UTF-8<\/span><\/span>\n<span class=\"line\"><span style=\"color: #e0def4\">server: nginx<\/span><\/span>\n<span class=\"line\"><span style=\"color: #e0def4\">cache-control: max-age=3600<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<div style=\"height:12px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>The <code>-I<\/code> flag is useful when you want to quickly check:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>If a server is live<\/li>\n\n\n\n<li>The <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTTP\/Reference\/Status\" target=\"_blank\" rel=\"noopener\">HTTP status code<\/a> (like 200, 301, 404)<\/li>\n\n\n\n<li>Redirects, <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTTP\/Reference\/Headers\/Access-Control-Allow-Origin\" target=\"_blank\" rel=\"noopener\">CORS headers<\/a>, caching, content types, and more<\/li>\n<\/ul>\n\n\n\n<p>Since <code>-I<\/code> uses a <code>HEAD<\/code> request, it won\u2019t return the actual page or response body, just the headers. Some servers may even behave differently for <a href=\"https:\/\/datatracker.ietf.org\/doc\/html\/rfc7231#section-4.3.2\" target=\"_blank\" rel=\"noopener\">HEAD vs. GET<\/a> requests (e.g., skipping auth or cookies), so this flag is ideal for quick inspections, not for simulating full browser behavior.<\/p>\n\n\n\n<div style=\"height:24px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large is-resized centered\"><img decoding=\"async\" width=\"1024\" height=\"536\" src=\"https:\/\/proxidize.com\/wp-content\/uploads\/2025\/07\/how-headers-with-full-response-1024x536.jpg\" alt=\"A drawing of curl showing a full HTTP header under the title &quot;How Headers With the Full Response&quot;.\" class=\"wp-image-78025\" style=\"object-fit:cover\" srcset=\"https:\/\/proxidize.com\/wp-content\/uploads\/2025\/07\/how-headers-with-full-response-1024x536.jpg 1024w, https:\/\/proxidize.com\/wp-content\/uploads\/2025\/07\/how-headers-with-full-response-300x157.jpg 300w, https:\/\/proxidize.com\/wp-content\/uploads\/2025\/07\/how-headers-with-full-response-768x402.jpg 768w, https:\/\/proxidize.com\/wp-content\/uploads\/2025\/07\/how-headers-with-full-response-600x314.jpg 600w, https:\/\/proxidize.com\/wp-content\/uploads\/2025\/07\/how-headers-with-full-response.jpg 1200w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<div style=\"height:24px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Show Headers With the Full Response<\/h2>\n\n\n\n<p>If you want to see both the headers and the response body in a single request for example, to check headers while also viewing the <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTTP\" target=\"_blank\" rel=\"noopener\">API response<\/a> or HTML content you can use the <a href=\"https:\/\/curl.se\/docs\/manpage.html#-i\" target=\"_blank\" rel=\"noopener\"><code>-i<\/code> flag<\/a>.<\/p>\n\n\n\n<p><strong>Example:<\/strong><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.75rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#e0def4;--cbp-line-number-width:calc(1 * 0.6 * .75rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e0def4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>curl -i https:\/\/example.com<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki rose-pine-moon\" style=\"background-color: #232136\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #EA9A97\">curl<\/span><span style=\"color: #E0DEF4\"> <\/span><span style=\"color: #3E8FB0\">-i<\/span><span style=\"color: #E0DEF4\"> <\/span><span style=\"color: #F6C177\">https:\/\/example.com<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<div style=\"height:12px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>This sends a normal <code>GET<\/code> request and includes the headers at the top of the response.<\/p>\n\n\n\n<p>Sample Output:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.75rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#e0def4;--cbp-line-number-width:calc(2 * 0.6 * .75rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e0def4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>HTTP\/2 200\ndate: Tue, 02 Jul 2024 10:00:00 GMT\ncontent-type: text\/html; charset=UTF-8\nserver: nginx\n\n&lt;!doctype html>\n&lt;html>\n  &lt;head>...&lt;\/head>\n  &lt;body>...&lt;\/body>\n&lt;\/html><\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki rose-pine-moon\" style=\"background-color: #232136\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #e0def4\">HTTP\/2 200<\/span><\/span>\n<span class=\"line\"><span style=\"color: #e0def4\">date: Tue, 02 Jul 2024 10:00:00 GMT<\/span><\/span>\n<span class=\"line\"><span style=\"color: #e0def4\">content-type: text\/html; charset=UTF-8<\/span><\/span>\n<span class=\"line\"><span style=\"color: #e0def4\">server: nginx<\/span><\/span>\n<span class=\"line\"><span style=\"color: #e0def4\"><\/span><\/span>\n<span class=\"line\"><span style=\"color: #e0def4\">&lt;!doctype html&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #e0def4\">&lt;html&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #e0def4\">  &lt;head&gt;...&lt;\/head&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #e0def4\">  &lt;body&gt;...&lt;\/body&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #e0def4\">&lt;\/html&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<div style=\"height:12px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>When to use <code>-i<\/code>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>When you want to debug headers and content together<\/li>\n\n\n\n<li>When testing an API response or page output<\/li>\n\n\n\n<li>When comparing how headers change across environments (e.g.,staging vs production)&nbsp;<\/li>\n<\/ul>\n\n\n\n<p>If you\u2019re parsing the response in a script, <code>-i<\/code> might break tools that expect raw JSON or HTML since the headers will be included at the top.<\/p>\n\n\n\n<div style=\"height:24px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large is-resized centered\"><img decoding=\"async\" width=\"1024\" height=\"536\" src=\"https:\/\/proxidize.com\/wp-content\/uploads\/2025\/07\/show-only-headers-from-a-get-request-1024x536.jpg\" alt=\"a screenshot of a computer program under the title &quot;Show Only Headers from a GET Request (No Body)&quot;.\" class=\"wp-image-78030\" style=\"object-fit:cover\" srcset=\"https:\/\/proxidize.com\/wp-content\/uploads\/2025\/07\/show-only-headers-from-a-get-request-1024x536.jpg 1024w, https:\/\/proxidize.com\/wp-content\/uploads\/2025\/07\/show-only-headers-from-a-get-request-300x157.jpg 300w, https:\/\/proxidize.com\/wp-content\/uploads\/2025\/07\/show-only-headers-from-a-get-request-768x402.jpg 768w, https:\/\/proxidize.com\/wp-content\/uploads\/2025\/07\/show-only-headers-from-a-get-request-600x314.jpg 600w, https:\/\/proxidize.com\/wp-content\/uploads\/2025\/07\/show-only-headers-from-a-get-request.jpg 1200w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<div style=\"height:24px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Show Only Headers from a GET Request (No Body)<\/h2>\n\n\n\n<p>Sometimes, you want to inspect the response headers from a real GET request, but you don\u2019t care about the body (or don\u2019t want it cluttering your terminal). This is especially useful when you\u2019re checking redirect behavior, CORS policies, rate limits, or caching headers.<br><br>To do that, you can combine a few <a href=\"https:\/\/curl.se\/docs\/manpage.html\" target=\"_blank\" rel=\"noopener\">cURL flags<\/a>:<\/p>\n\n\n\n<p><strong>Example:<\/strong><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.75rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#e0def4;--cbp-line-number-width:calc(1 * 0.6 * .75rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e0def4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>curl -s -D - https:\/\/example.com -o \/dev\/null<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki rose-pine-moon\" style=\"background-color: #232136\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #EA9A97\">curl<\/span><span style=\"color: #E0DEF4\"> <\/span><span style=\"color: #3E8FB0\">-s<\/span><span style=\"color: #E0DEF4\"> <\/span><span style=\"color: #3E8FB0\">-D<\/span><span style=\"color: #E0DEF4\"> <\/span><span style=\"color: #F6C177\">-<\/span><span style=\"color: #E0DEF4\"> <\/span><span style=\"color: #F6C177\">https:\/\/example.com<\/span><span style=\"color: #E0DEF4\"> <\/span><span style=\"color: #3E8FB0\">-o<\/span><span style=\"color: #E0DEF4\"> <\/span><span style=\"color: #F6C177\">\/dev\/null<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<div style=\"height:12px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>What each flag does:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>-D<\/code><strong>:<\/strong> Dumps the response headers to standard output.<\/li>\n\n\n\n<li><code>-o<strong>:<\/strong> \/dev\/null<\/code>: Sends the response body to a black hole (which you can\u2019t view).<\/li>\n\n\n\n<li><code>-s<\/code><strong>:<\/strong> Runs in silent mode (you won\u2019t see any progress bar or errors unless it\u2019s critical).<\/li>\n<\/ul>\n\n\n\n<p>Sample Output:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.75rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#e0def4;--cbp-line-number-width:calc(1 * 0.6 * .75rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e0def4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>HTTP\/2 200\ndate: Tue, 02 Jul 2024 10:00:00 GMT\ncontent-type: application\/json\ncache-control: no-cache<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki rose-pine-moon\" style=\"background-color: #232136\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #e0def4\">HTTP\/2 200<\/span><\/span>\n<span class=\"line\"><span style=\"color: #e0def4\">date: Tue, 02 Jul 2024 10:00:00 GMT<\/span><\/span>\n<span class=\"line\"><span style=\"color: #e0def4\">content-type: application\/json<\/span><\/span>\n<span class=\"line\"><span style=\"color: #e0def4\">cache-control: no-cache<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<div style=\"height:12px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>When to use this:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>You want the full headers from a GET request (unlike -I, which sends a HEAD request)<\/li>\n\n\n\n<li>You\u2019re scripting something and need a clean headers-only output<\/li>\n\n\n\n<li>You\u2019re validating actual server responses, including cookies, redirect chains, and authentication-related headers.<\/li>\n<\/ul>\n\n\n\n<div style=\"height:24px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large is-resized centered\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"536\" src=\"https:\/\/proxidize.com\/wp-content\/uploads\/2025\/07\/save-headers-to-a-file-using-d-headers-txt-1024x536.jpg\" alt=\"Various text boxes with code under the title &quot;Save Headers to a File Using -D headers.txt&quot;.\" class=\"wp-image-78028\" style=\"object-fit:cover\" srcset=\"https:\/\/proxidize.com\/wp-content\/uploads\/2025\/07\/save-headers-to-a-file-using-d-headers-txt-1024x536.jpg 1024w, https:\/\/proxidize.com\/wp-content\/uploads\/2025\/07\/save-headers-to-a-file-using-d-headers-txt-300x157.jpg 300w, https:\/\/proxidize.com\/wp-content\/uploads\/2025\/07\/save-headers-to-a-file-using-d-headers-txt-768x402.jpg 768w, https:\/\/proxidize.com\/wp-content\/uploads\/2025\/07\/save-headers-to-a-file-using-d-headers-txt-600x314.jpg 600w, https:\/\/proxidize.com\/wp-content\/uploads\/2025\/07\/save-headers-to-a-file-using-d-headers-txt.jpg 1200w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<div style=\"height:24px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Save Headers to a File (Using <code>-D headers.txt<\/code>)<\/h2>\n\n\n\n<p>If you want to save response headers for later analysis or feed them into another tool or script cURL makes it easy with <a href=\"https:\/\/curl.se\/docs\/manpage.html#-D\" target=\"_blank\" rel=\"noopener\"><code>-D<\/code> flag<\/a>.<\/p>\n\n\n\n<p><strong>Example:<\/strong><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.75rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#e0def4;--cbp-line-number-width:calc(1 * 0.6 * .75rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e0def4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>curl -D headers.txt https:\/\/example.com -o \/dev\/null<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki rose-pine-moon\" style=\"background-color: #232136\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #EA9A97\">curl<\/span><span style=\"color: #E0DEF4\"> <\/span><span style=\"color: #3E8FB0\">-D<\/span><span style=\"color: #E0DEF4\"> <\/span><span style=\"color: #F6C177\">headers.txt<\/span><span style=\"color: #E0DEF4\"> <\/span><span style=\"color: #F6C177\">https:\/\/example.com<\/span><span style=\"color: #E0DEF4\"> <\/span><span style=\"color: #3E8FB0\">-o<\/span><span style=\"color: #E0DEF4\"> <\/span><span style=\"color: #F6C177\">\/dev\/null<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<div style=\"height:12px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>What each flag does:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>-D headers.txt<\/code>: Saves the headers to a file named headers.txt<\/li>\n\n\n\n<li><code>-o \/dev\/null<\/code>: Prevents the body from being saved or displayed<\/li>\n<\/ul>\n\n\n\n<p>Optional: Add <code>-s<\/code> to make the command silent. Refer to the example below:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.75rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#e0def4;--cbp-line-number-width:calc(1 * 0.6 * .75rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e0def4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>curl -s -D headers.txt https:\/\/example.com -o \/dev\/null<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki rose-pine-moon\" style=\"background-color: #232136\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #EA9A97\">curl<\/span><span style=\"color: #E0DEF4\"> <\/span><span style=\"color: #3E8FB0\">-s<\/span><span style=\"color: #E0DEF4\"> <\/span><span style=\"color: #3E8FB0\">-D<\/span><span style=\"color: #E0DEF4\"> <\/span><span style=\"color: #F6C177\">headers.txt<\/span><span style=\"color: #E0DEF4\"> <\/span><span style=\"color: #F6C177\">https:\/\/example.com<\/span><span style=\"color: #E0DEF4\"> <\/span><span style=\"color: #3E8FB0\">-o<\/span><span style=\"color: #E0DEF4\"> <\/span><span style=\"color: #F6C177\">\/dev\/null<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<div style=\"height:12px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>Sample Output:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.75rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#e0def4;--cbp-line-number-width:calc(1 * 0.6 * .75rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e0def4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>HTTP\/2 200\ndate: Tue, 02 Jul 2024 10:00:00 GMT\ncontent-type: application\/json\nx-powered-by:Express<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki rose-pine-moon\" style=\"background-color: #232136\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #e0def4\">HTTP\/2 200<\/span><\/span>\n<span class=\"line\"><span style=\"color: #e0def4\">date: Tue, 02 Jul 2024 10:00:00 GMT<\/span><\/span>\n<span class=\"line\"><span style=\"color: #e0def4\">content-type: application\/json<\/span><\/span>\n<span class=\"line\"><span style=\"color: #e0def4\">x-powered-by:Express<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<div style=\"height:12px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>When to use this:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>You\u2019re debugging an API and want to inspect headers across multiple calls<\/li>\n\n\n\n<li>You want to compare headers from different servers (e.g.,staging vs production)<\/li>\n\n\n\n<li>You\u2019re writing automation scripts and want to log HTTP metadata without parsing in real-time<\/li>\n<\/ul>\n\n\n\n<div style=\"height:24px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large is-resized centered\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"536\" src=\"https:\/\/proxidize.com\/wp-content\/uploads\/2025\/07\/show-both-requests-and-response-headers-1024x536.jpg\" alt=\"a computer screen with text overlay under the title &quot;How Both Requests &amp; Response Headers Using -v)&quot;.\" class=\"wp-image-78029\" style=\"object-fit:cover\" srcset=\"https:\/\/proxidize.com\/wp-content\/uploads\/2025\/07\/show-both-requests-and-response-headers-1024x536.jpg 1024w, https:\/\/proxidize.com\/wp-content\/uploads\/2025\/07\/show-both-requests-and-response-headers-300x157.jpg 300w, https:\/\/proxidize.com\/wp-content\/uploads\/2025\/07\/show-both-requests-and-response-headers-768x402.jpg 768w, https:\/\/proxidize.com\/wp-content\/uploads\/2025\/07\/show-both-requests-and-response-headers-600x314.jpg 600w, https:\/\/proxidize.com\/wp-content\/uploads\/2025\/07\/show-both-requests-and-response-headers.jpg 1200w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<div style=\"height:24px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Show Both Requests &amp; Response Headers (Using <code>-v<\/code>)<\/h2>\n\n\n\n<p>If you want to see all data, the headers your client sends and the headers the server responds with use the <a href=\"https:\/\/ec.haxx.se\/usingcurl\/verbose\/\" target=\"_blank\" rel=\"noopener\"><code>-v<\/code> (verbose) flag<\/a>. This is especially useful when debugging authentication, redirects, cookies, or content negotiation.<\/p>\n\n\n\n<p><strong>Example:<\/strong><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.75rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#e0def4;--cbp-line-number-width:calc(1 * 0.6 * .75rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e0def4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>curl -v https:\/\/example.com<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki rose-pine-moon\" style=\"background-color: #232136\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #EA9A97\">curl<\/span><span style=\"color: #E0DEF4\"> <\/span><span style=\"color: #3E8FB0\">-v<\/span><span style=\"color: #E0DEF4\"> <\/span><span style=\"color: #F6C177\">https:\/\/example.com<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<div style=\"height:12px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>What to expect from this command:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Request headers (what cURL sends to the server)<\/li>\n\n\n\n<li>Response headers (what the server sends back)<\/li>\n\n\n\n<li>A breakdown of the SSL handshake<\/li>\n<\/ul>\n\n\n\n<p>Sample Output:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.75rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#e0def4;--cbp-line-number-width:calc(2 * 0.6 * .75rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#e0def4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>* Trying 93.184.216.34:443...\n* connected to example.com (93.184.216.34) port 443 (#0)\n> GET \/ HTTP\/2\n> Host: example.com\n> User-Agent: curl\/8.0.1\n> Accept: *\/*\n\n&lt; HTTP\/2 200\n&lt; Date: Tue, 02 Jul 2024 10:00:00 GMT\n&lt; Content-Type: text\/html; charset=UTF-8\n&lt; Server: nginx<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki rose-pine-moon\" style=\"background-color: #232136\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #e0def4\">* Trying 93.184.216.34:443...<\/span><\/span>\n<span class=\"line\"><span style=\"color: #e0def4\">* connected to example.com (93.184.216.34) port 443 (#0)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #e0def4\">&gt; GET \/ HTTP\/2<\/span><\/span>\n<span class=\"line\"><span style=\"color: #e0def4\">&gt; Host: example.com<\/span><\/span>\n<span class=\"line\"><span style=\"color: #e0def4\">&gt; User-Agent: curl\/8.0.1<\/span><\/span>\n<span class=\"line\"><span style=\"color: #e0def4\">&gt; Accept: *\/*<\/span><\/span>\n<span class=\"line\"><span style=\"color: #e0def4\"><\/span><\/span>\n<span class=\"line\"><span style=\"color: #e0def4\">&lt; HTTP\/2 200<\/span><\/span>\n<span class=\"line\"><span style=\"color: #e0def4\">&lt; Date: Tue, 02 Jul 2024 10:00:00 GMT<\/span><\/span>\n<span class=\"line\"><span style=\"color: #e0def4\">&lt; Content-Type: text\/html; charset=UTF-8<\/span><\/span>\n<span class=\"line\"><span style=\"color: #e0def4\">&lt; Server: nginx<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<div style=\"height:12px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>When to use <code>-v<\/code>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>You want to confirm what headers your client is sending (e.g. Authorization , Accept , User-Agent)<\/li>\n\n\n\n<li>You\u2019re troubleshooting auth issues or CORS problems<\/li>\n\n\n\n<li>You\u2019re inspecting redirects or cookies being set<\/li>\n<\/ul>\n\n\n\n<div style=\"height:24px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large is-resized centered\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"536\" src=\"https:\/\/proxidize.com\/wp-content\/uploads\/2025\/07\/common-use-cases-for-viewing-headers-with-curl-1024x536.jpg\" alt=\"A drawing of an HTTP header under the title &quot;Common Use Cases for Viewing Headers with cURL&quot;.\" class=\"wp-image-78024\" style=\"object-fit:cover\" srcset=\"https:\/\/proxidize.com\/wp-content\/uploads\/2025\/07\/common-use-cases-for-viewing-headers-with-curl-1024x536.jpg 1024w, https:\/\/proxidize.com\/wp-content\/uploads\/2025\/07\/common-use-cases-for-viewing-headers-with-curl-300x157.jpg 300w, https:\/\/proxidize.com\/wp-content\/uploads\/2025\/07\/common-use-cases-for-viewing-headers-with-curl-768x402.jpg 768w, https:\/\/proxidize.com\/wp-content\/uploads\/2025\/07\/common-use-cases-for-viewing-headers-with-curl-600x314.jpg 600w, https:\/\/proxidize.com\/wp-content\/uploads\/2025\/07\/common-use-cases-for-viewing-headers-with-curl.jpg 1200w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<div style=\"height:24px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Common Use Cases for Viewing Headers with cURL<\/h2>\n\n\n\n<p>Viewing HTTP headers is just a powerful way to understand how servers, APIs, and content delivery behave. Below are some of the most common real-world use cases used by developers:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Debugging <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTTP\" target=\"_blank\" rel=\"noopener\">API calls<\/a> for quick check<\/li>\n\n\n\n<li>Checking redirects (you should inspect <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTTP\/Reference\/Headers\/Location\" target=\"_blank\" rel=\"noopener\">location headers<\/a> to trace)<\/li>\n\n\n\n<li>Verifying <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTTP\/Reference\/Headers\/Cache-Control\" target=\"_blank\" rel=\"noopener\">caching behavior<\/a><\/li>\n\n\n\n<li>Troubleshooting CORS errors<\/li>\n\n\n\n<li>Inspecting <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTTP\/Reference\/Headers\/Set-Cookie\" target=\"_blank\" rel=\"noopener\">cookies<\/a><\/li>\n\n\n\n<li>Analyzing CDN or <a href=\"https:\/\/proxidize.com\/proxy-server\/\">proxy<\/a> behavior<\/li>\n<\/ul>\n\n\n\n<div style=\"height:24px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p><a href=\"https:\/\/curl.se\/\" target=\"_blank\" rel=\"noopener\">cURL<\/a> is a great tool for inspecting HTTP traffic and viewing response headers is a key part of debugging, optimizing, and securing any web application.<\/p>\n\n\n\n<p><strong>Key Takeaways:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use curl <code>-I<\/code> to send a <strong>HEAD request<\/strong> and see headers only (no body).<\/li>\n\n\n\n<li>Use curl <code>-i<\/code> to include <strong>headers with the response body<\/strong>.<\/li>\n\n\n\n<li>Combine <code>-s -D - -o \/dev\/null<\/code> to get <strong>headers only from a GET request<\/strong>.<\/li>\n\n\n\n<li>Use <code>-D headers.txt<\/code> to <strong>save headers to a file<\/strong> for later analysis.<\/li>\n\n\n\n<li>Use <code>-v<\/code> to see <strong>both request and response headers<\/strong> ideal for debugging.<\/li>\n<\/ul>\n\n\n\n<p>Whether you\u2019re checking API status codes, debugging authentication flows, or optimizing caching behavior, knowing how to show headers (and when to use which flag) can save you time and headaches.<\/p>\n","protected":false},"author":8854,"featured_media":78027,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","categories":[266],"tags":[],"class_list":["post-77627","blog","type-blog","status-publish","format-standard","has-post-thumbnail","hentry","category-tech-tutorials-and-programming"],"acf":[],"_links":{"self":[{"href":"https:\/\/proxidize.com\/wp-json\/wp\/v2\/blog\/77627","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/proxidize.com\/wp-json\/wp\/v2\/blog"}],"about":[{"href":"https:\/\/proxidize.com\/wp-json\/wp\/v2\/types\/blog"}],"author":[{"embeddable":true,"href":"https:\/\/proxidize.com\/wp-json\/wp\/v2\/users\/8854"}],"replies":[{"embeddable":true,"href":"https:\/\/proxidize.com\/wp-json\/wp\/v2\/comments?post=77627"}],"version-history":[{"count":4,"href":"https:\/\/proxidize.com\/wp-json\/wp\/v2\/blog\/77627\/revisions"}],"predecessor-version":[{"id":84763,"href":"https:\/\/proxidize.com\/wp-json\/wp\/v2\/blog\/77627\/revisions\/84763"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/proxidize.com\/wp-json\/wp\/v2\/media\/78027"}],"wp:attachment":[{"href":"https:\/\/proxidize.com\/wp-json\/wp\/v2\/media?parent=77627"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/proxidize.com\/wp-json\/wp\/v2\/categories?post=77627"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/proxidize.com\/wp-json\/wp\/v2\/tags?post=77627"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}