Puede ser necesario depurar problemas con headers enviados por un servidor web en respuestas HTTP. Este artículo demuestra cómo ver las cabeceras de una respuesta HTTP con curl.
La opción -D
de curl
permite volcar las cabeceras (headers) HTTP recibidas en la respuesta del servidor. Esta opción toma como parámetro un archivo destino del dump. Sin embargo, es posible utilizar -
para volcarlas por salida estándar:
curl -D - URL
Por ejemplo:
emi@vaio:/tmp$ curl -D - https://www.linuxito.com/images/cientifico.png HTTP/1.1 200 OK Server: nginx Date: Wed, 02 Dec 2020 14:23:22 GMT Content-Type: image/png Content-Length: 49134 Last-Modified: Mon, 02 Nov 2020 16:27:58 GMT Connection: keep-alive ETag: "5fa0338e-bfee" Expires: Thu, 02 Dec 2021 14:23:22 GMT Cache-Control: max-age=31536000 Strict-Transport-Security: max-age=63072000; includeSubDomains X-Frame-Option: DENY X-Content-Type-Options: nosniff Accept-Ranges: bytes Warning: Binary output can mess up your terminal. Use "--output -" to tell Warning: curl to output it to your terminal anyway, or consider "--output Warning: &lT;FILE>" to save to a file.