The HTTP HEAD method is a type of HTTP request that is identical to HTTP GET, except that the server will not return a message-body as part of the HTTP response. Rather, it will only send the HTTP headers and will end immediately following the HTTP header section.
A HTTP request of this type is sent by a client to retrieve only the HTTP header information for a resource. It can be used to obtain metadata for the resource without having to consume the bandwidth required to download the message body. This HTTP method can be used, for example, to test hyperlinks for validity and recent changes.
As with the HTTP GET request, including a message body with the HTTP request is undefined and such HTTP requests are rejected by some implementations. It is a safe and idempotent HTTP method, and the results are cacheable.
If an HTTP HEAD response indicates that a corresponding cached copy of the resource is outdated then it will be marked as stale.
This example fetches only the HTTP header section of the root page from the specified URL and can be used to verify that the resource is currently accessible.
HEAD / HTTP/1.1 Host: www.example.ai
HTTP/1.1 200 OK Content-Length: 500 Content-Type: text/html
The HTTP HEAD request method is identical to HTTP GET but only retrieves the HTTP response Headers of the specified URL, omitting the representation of the resource. It can be used for testing resource availability.