Do any modern browsers ever issue an HTTP HEAD req

2019-07-14 04:43发布

问题:

I understand what a HEAD request is, and what it could be used for. Will any standard, modern browser ever send a HEAD request? If so, in what context?

回答1:

A browser will send a HEAD request if that is explicitly requested in an XMLHttpRequest, but I'm fairly certain that the browser will never send a HEAD request of its own accord. My evidence is that the Tornado web server defaults to returning an error for HEAD requests and I've never heard of anyone running into problems related to this (or even being aware of it).

HEAD is mostly obsolete IMHO: on a dynamic web site it is unlikely to be significantly more efficient than a GET, and it can usually be replaced by one of the following:

  • Conditional GET with If-Modified-Since or If-None-Match (used for caching)
  • Partial GET with Range header (used for e.g. streaming video)
  • OPTIONS (used for CORS preflight requests)


标签: http