Dhairya Shah
Dhairya Shah's Blog

Dhairya Shah's Blog

Get response header using cURL request

Get response header using cURL request

Dhairya Shah's photo
Dhairya Shah
Ā·Sep 17, 2022Ā·

1 min read

Subscribe to my newsletter and never miss my upcoming articles

Play this article

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!

Ā 
Share this