The HTTP HEAD method is used to request HTTP headers from the server. The HTTP HEAD request is identical to the GET request except that the server must not return the message body in the response. Requests using the HTTP HEAD method should only retrieve data (server must not change its state). If you want to change data on the server, use POST, PUT, PATCH or DELETE methods.

The HTTP HEAD request may be executed before loading a large resource, to check resource size, validity, accessibility, and recent modification. (would be indicated by Content-Length/Last-Modified headers).

The HTTP HEAD requests cannot have a message body. But you still can send data to the server using the URL parameters. In this case, you are limited to the maximum size of the URL, which is about 2000 characters (it depends on the browser).

The HTTP HEAD method is defined as idempotent, which means that multiple identical HEAD requests should have the same effect as a single request.

The following HTTP HEAD request example demonstrates sending a HEAD request to the server.

HEAD Request Example Run Example
HEAD /echo/head/json HTTP/1.1
Accept: application/json

And the server response:

Server Response to HTTP HEAD Request
HTTP/1.1 200 OK
Content-Length: 19
Content-Type: application/json

Some notes on HTTP HEAD requests

  • HEAD requests can be cached
  • HEAD requests should never be used when dealing with sensitive data
Last updated: Viewed: 6288 times