What is the difference between the HTTP methods HEAD and OPTIONS?

What is the difference between the HTTP methods HEAD and OPTIONS? I only know that in response to OPTIONS, the server should give an Allow with a list of supported methods. Are there any other conceptual / technical differences?

Author: Artur Panteleev, 2017-08-18

3 answers

These requests have different purposes:

  • HEAD - used to check the existence of the resource, it is completely similar to GET, but without returning the body of the response
  • OPTIONS - it is used to get parameters for a resource or for the server as a whole and the resource itself is not affected (that is, it is a cheaper operation compared to HEAD)

OPTIONS returns the parameters in the header. List of parameters depends on the resource and / or server. This is usually the Allow header, which describes which methods are available for the resource.

 2
Author: Mikhail Vaysman, 2017-08-18 14:11:02

HEAD

This method is essentially similar to GET, but the server responds to the request with a single header. (Hence the name of the method.) It is used, for example, to find out whether a particular URL exists on the network and whether any changes have occurred.


OPTIONS

The method represents a request for information about the connection options available in the request/response chain identified by the requested URI (Request-URI). This method allows the client to define options and / or requirements related to the resource or server capabilities, but without performing any actions on the resource or initiating its loading.

 2
Author: Aliaksandr Pitkevich, 2017-08-18 13:00:25

The difference between these methods is that HEAD requests information about the resource, and OPTIONS requests information about the access methods to the resource.

In more detail.

The headers returned by the HEAD method must match the headers returned by the GET method. At the same time, the HEAD method has nothing to do with the POST, PUT, DELETE, and other methods.

At the same time, the access settings returned by the OPTIONS method are relevant to all of the resource's GET methods at once., POST, PUT, DELETE, etc.


If we talk about the application, the HEAD method can be used to get information about the page without downloading the page itself. The OPTIONS method is mainly used by the Preflight request mechanism in CORS or for detecting server-supported features in WebDAV.

 1
Author: Pavel Mayorov, 2017-08-18 13:05:03