How to Show HTTP Response Headers with cURL?

If you want to really understand how a website or API behaves, looking at the HTTP response headers is one of the easiest wins. With curl, you can see status codes, cookies, caching rules, redirects, security headers and more, all from your terminal. In this guide, you will learn how to show HTTP response headers with curl, understand common problems, and quickly debug your requests.

Valentin Ghita

Technical Writer, Marketing, Research

Mihalcea Romeo

Co-Founder, CTO

updated 2026-04-14T16:07:49.019Z

How to View HTTP Headers Using Different Techniques

A quick HEAD request with curl -I

The fastest way to see HTTP response headers only is a HEAD request.

What happens here:

  • -I switches the method to HTTP HEAD
  • The server returns headers only, without the body
  • You get a short, scannable block of information

If the site redirects (HTTP 301 / 302) and you want to see every hop, just add -L.

Now curl prints headers for each redirect plus the final page.

Seeing headers and body together with -i

When you are testing an API or JSON endpoint, it is nice to see headers and body in one go.

Basically what happens is this.

  • -i (or --include) prints the response headers first
  • Then a blank line
  • Then the body (HTML, JSON, etc.)

This is perfect when you want to confirm the status code, Content-Type and the actual JSON payload without running separate commands.

Dumping only headers from a GET with -D and -o

Some servers behave differently for HEAD vs GET, so it is often safer to inspect headers from a real GET request.

To print only the headers from a GET, try the script below.

What each flag does:

  • -s hides the progress meter
  • -D - dumps the response headers to standard output
  • -o /dev/null discards the body

If you want to save the headers to a file for later, write this in your terminal.

Now response-headers.txt is ready to be searched, shared with your team or committed to a repo.

Full request and response debugging with curl -v

When things get weird, verbose mode can give you the full picture.

Verbose output shows:

  • The request line and headers you send (prefixed with >)
  • The response status line and headers you receive (prefixed with <)
  • Protocol version, connection reuse, TLS details, and more

Issues You Often See When Working with HTTP Headers

HEAD and GET don’t tell the same story

A common mistake is to assume curl -I tells you the full truth. In reality, some servers:

  • Set cookies only on GET
  • Use different caching headers for HEAD
  • Implement HEAD in a minimal or buggy way

If something does not add up, compare these 2 scripts.

Use the GET version as the reference for real user behavior.

Redirects hiding the real headers

If you only run:

you might only see the first 301/302. The final page (where users actually land) may have completely different headers.

Always add -L when you care about the final response:

This exposes all the redirect steps and the final Cache-ControlSet-Cookie, and security headers.

Proxies quietly rewriting or triggering headers

When you send requests through our residential proxies, some sites adapt behavior based on IP, country or ASN. You may see:

  • Different Set-Cookie values
  • Geo-specific Content-Language
  • Extra security or rate limit headers

An example is:

Compare this with the same command run without -x. Any differences in headers tell you how that site treats traffic from different IP ranges.

Too many headers, not enough signal

Modern responses can have a lot of headers. When you only care about one or two, scrolling through everything is a waste of time.

Filter headers in the shell:

Only cookies:

Caching related headers:

This keeps your focus on the values that actually matter for the problem you are solving.

How cURL Is Commonly Used to View HTTP Headers

Checking website behavior from different IPs

One of the most powerful combinations is curl plus rotating residential proxies. You can see how a site behaves from multiple countries and networks without leaving your terminal.

For example, you can test a URL through one of our endpoints:

With this pattern you can compare:

  • Status codes (200 vs 403/429)
  • Geo-based redirects (Location)
  • Region-specific cookies and personalization

Debugging caching and CDN headers on live sites

Headers are the main way to understand CDN and browser caching rules. A very common way to inspect caching for a static asset is to run the script below.

With one short command, you can instantly see how long the asset is allowed to stay in cache through directives.

Inspecting login flows, sessions and API behavior

When you move to login flows and APIs, headers become even more important. For a login page, you can run the script below.

Here you look at Set-Cookie, security flags like Secure and HttpOnlySameSite, and any redirect locations.

For an API endpoint, something like this works well.

When you look closely at the response headers, you can instantly confirm that the server is really sending JSON by checking the Content-Type. You can also see any rate limiting headers that tell you how often you are allowed to hit the API before it starts rejecting requests.

Conclusion

Once you get comfortable reading HTTP headers with curl in quiet mode, you unlock a serious advantage in web development. You can spot why an API is failing without guessing, understand why a scraper suddenly broke, and catch misconfigurations that might slow things down or block requests entirely. You now have several practical ways to inspect exactly what a server sends back and to pick the right approach for each situation. If you ever want a second pair of eyes on an issue, our support team is always here to help.

Recommended product

Buy Backconnect Proxies

Rotating IPs on every request. Scale scraping and automation without manual IP management.

Similar posts to this one

Read about the latest news and updates.

Curl with Python hero image
updated·2026-04-14T15:58:47.347Z

How to Use cURL With Python: A Complete Guide

cURL is best known as a command-line tool for handling web transfers, but you can also use its core functionality inside Python. That matters when you want more control over requests, headers, redirects, proxies, and response handling than simpler tools usually give you. In Python, PycURL brings that lower-level cURL behavior into your code, which makes it useful for testing APIs, automating requests, and scraping pages. In this guide, you’ll see how to use cURL with Python to send different types of requests, work with proxies, and scrape website data with PycURL.

Curl ignore ssl hero image
updated·2026-04-03T04:28:03.672Z

How to Ignore SSL Certificate Errors in cURL: Complete Guide

SSL certificates, more accurately TLS certificates, are what help browsers and tools like cURL confirm a website is genuine. They do this by checking the certificate comes from a trusted authority, matches the domain you requested and is still valid. When any of those checks fail, you will often see a warning or a blocked request because the client cannot reliably verify who it is talking to. Now, that does not always mean the site is unsafe, sometimes the certificate simply expired or the chain is misconfigured. In this guide, you will learn what are these SSL certificates, their common errors, and why you might want to bypass them with cURL.

Send http headers using curl hero image
updated·2026-04-14T16:10:45.555Z

How to Send HTTP Headers With cURL: A Beginner's Guide

HTTP headers contain most of the context that will inform a server who you are, what you want, and how to respond. Using cURL you'll be able to add, read, and troubleshoot those headers to ensure that your scraping or API calls are reliable. This guide will show you how to work with headers in cURL, how to send and view them, its use cases, and how you can solve common header issues.

Curl Post Requests Hero Image.
updated·2026-04-03T04:28:04.670Z

How to Send cURL POST Requests: Step-by-Step Guide

At some point, if you're working with APIs, you will need to push data from the terminal. This is where cURL is great. In this tutorial, you will learn what a POST request is, how to send one with cURL, and the options that are useful for typical tasks.

 

Ready to get started?

We accept all forms of payment, including crypto.