Should the HEAD
and GET
methods return the same status code? More specifically, we have run into the situation where a client website is returning a 200
when we do a HEAD
, but returns a 303
when we do a GET
. It has to do with redirecting to a language specific page based on location, but shouldn't the HEAD
then also ask you to redirect?
but shouldn't the HEAD then also ask you to redirect?
The key is the word SHOULD
. From the HTTP method specification, RFC9110:
9.3.2 HEAD
The HEAD method is identical to GET except that the server MUST NOT send content in the response. HEAD is used to obtain metadata about the selected representation without transferring its representation data, often for the sake of testing hypertext links or finding recent modifications.
The server SHOULD send the same header fields in response to a HEAD request as it would have sent if the request method had been GET. However, a server MAY omit header fields for which a value is determined only while generating the content..
The word SHOULD is further definied in RFC2119:
SHOULD
This word, or the adjective "RECOMMENDED", mean that there may exist valid reasons in particular circumstances to ignore a particular item, but the full implications must be understood and carefully weighed before choosing a different course.
So, the case you described is legit, but not recommended. You may want to ask the site maintainer for the reasoning of this path.
SHOULD
ask them for their reasoning ;-) –
Consumption precise
answer looks like. +1. –
Lubric © 2022 - 2024 — McMap. All rights reserved.