What answer should be modified? So how does the HTTP header return if the request is HEAD?

If you send a GET request with the If-Modified-Since header, the server supports it and the file has not 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 that you would send if the file were modified?

In short: equivalent to GET / HEAD when requesting a file that hasn't changed?

+4
source share
1 answer

By RFC

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

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

In short: equivalent to GET / HEAD when requesting a file that hasn't changed?

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

+6
source

Source: https://habr.com/ru/post/1344862/


All Articles