Question

If you send a GET request with an If-Modified-Since header, the server suports it and the file hasn't changed, the server will return a 304 response.

If you sent a HEAD request in the same circumstances, should the server send a 304 response or send back the full headers you would have sent had the file changed?

In short: is GET / HEAD equivalent when requesting a file that has not changed?

Was it helpful?

Solution

As per RFC

The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response. The metainformation contained in the HTTP headers in response to a HEAD request SHOULD be identical to the information sent in response to a GET request.

Based on the above, the HEAD request in the same circumstances should return 304.

In short: is GET / HEAD equivalent when requesting a file that has not changed?

Again, based on what the RFC has to say, both GET and HEAD should be equivalent.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top