3

Lets say I have a file on a server with cache-headers indicating it should be cached. Will the response of a HEAD request to that file be cached as well?

Itai Hanski
  • 8,540
  • 5
  • 45
  • 65

1 Answers1

3

RFC 2616, 9.4 HEAD:

The response to a HEAD request MAY be cacheable in the sense that the information contained in the response MAY be used to update a previously cached entity from that resource.

It doesn't really make sense to cache the response to a HEAD request itself, as it contains no entity.

Community
  • 1
  • 1
CodeCaster
  • 147,647
  • 23
  • 218
  • 272
  • If there's a computation behind a HEAD request which takes longer, it might make sense to cache the request. But this MAY be cached indicates that the result of the computation should be cached on the server. – Balázs Németh Jul 15 '22 at 09:50