dhairyashah
Portfolio

Sep 17th, 2022

Get response header using cURL request

Author Picture

Dhairya Shah

Software Engineer

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!