Skip to main content

Command Palette

Search for a command to run...

Get response header using cURL request

Published
•1 min read
Get response header using cURL request
D

I am 17 years old and a young passionate and self-taught frontend web developer and have an intention to become a successful developer. I usually write about JavaScript and Web Development and share some tips in the articles.

cURL does not display request or response headers by default, instead displaying only the HTML contents.

To display only the response header, we can use header-only mode in the cURL request.

Here's how you do it:

curl www.dhairyashah.dev -I

or you can use, --head

curl www.dhairyashah.dev --head

Response:

➜  ~ curl https://www.dhairyashah.dev/ -I
HTTP/2 200 
accept-ranges: bytes
access-control-allow-origin: *
age: 46972
cache-control: public, max-age=0, must-revalidate
content-disposition: inline
content-type: text/html; charset=utf-8
date: Sat, 17 Sep 2022 06:53:44 GMT
etag: "d5aff17869c1be2e0a3f6fd2eb4bcbab"
server: Vercel
strict-transport-security: max-age=63072000
x-vercel-cache: HIT
x-vercel-id: bom1:bom1::nj9vf-1663397624418-d1ba39a46cf7
content-length: 15152

Thanks for reading

Follow me on Twitter

Thanks for reading!

More from this blog

D

Dhairya Shah

119 posts