You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
HEAD response status and headers are not equivalent to those of a GET response #2517
My understanding of the specification is that the response from a HEAD request should be (nearly) identical to a GET request with the main exception is that there is no body returned on a HEAD request. Other than that, the status code should be the same and the headers should be the same.
RepositoryEntityController#headCollectionResource returns a 204 when the GET response would return a 200. It is also missing headers for Content-Type and Transfer-Encoding. If the resource is not found, it correctly returns a 404.
RepositoryEntityController#headForItemResource returns a 204 when the GET response would return a 200 OK. In the case of using ETag value to set the request header If-None-Match or similar, if the GET request were to return a 304 Not Modified, the HEAD version of the same request still returns a 204 No Content. It's also adding a Cache-Control header where as the GET request does not.
RepositoryEntityController#headCollectionResource returns a 204 when the GET response would return a 200. It is also missing headers for Content-Type and Transfer-Encoding. If the resource is not found, it correctly returns a 404.
The calculation of those headers is out of our control, as it's Spring MVC adding these based on the content negotiation algorithm downstream of our controller depending on the actual object to be returned from the controller. That's one of the reasons we went with the 204 status code, as we don't expect clients to find these headers if there's no content to be transferred.
As for the item resource, the current design tries to align the status code with the HTTP method. So there's a gravity towards 204. I guess we could move to rather align with what the GET request would return. I'll schedule this for 5.1 M1, as we need to pass this through a minor release process to give folks the chance to adapt to the slightly changed header arrangement then.
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.
Activity
odrotbohm commentedon Jan 15, 2026
The calculation of those headers is out of our control, as it's Spring MVC adding these based on the content negotiation algorithm downstream of our controller depending on the actual object to be returned from the controller. That's one of the reasons we went with the
204status code, as we don't expect clients to find these headers if there's no content to be transferred.As for the item resource, the current design tries to align the status code with the HTTP method. So there's a gravity towards
204. I guess we could move to rather align with what theGETrequest would return. I'll schedule this for 5.1 M1, as we need to pass this through a minor release process to give folks the chance to adapt to the slightly changed header arrangement then.spring-projects-issues commentedon Jan 22, 2026
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
spring-projects-issues commentedon Jan 29, 2026
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.
loesak commentedon Jan 29, 2026
@odrotbohm I didn't see any feedback requested.
odrotbohm commentedon Jan 29, 2026
No worries. I the label back on, to signal that we would take further input / opinion. But that triggers our stale issues automation.
It's still on my todo list. Reopening.