NGINX does not update cache entry headers on 304 response
ladislav.macoun at cdn77.com
Fri Jan 3 11:03:59 UTC 2020
NGINX currently does not update the Expires HTTP header during cache revalidation after receiving 304 response from the origin. This may lead to receiving a response from cache with invalid Expires header, and not loading content from the browser disk cache.
It looks like this behaviour is intended as Maxim states this in the commit message
“As of now, no attempts are made to merge headers given in a 304 response during cache revalidation with headers previously stored in a cache item. Headers in a 304 response are only used to calculate new validity time of a cache item.”
This behaviour seems to present until now, the cache entry only updates the file cache header. And keeps the old response headers.
This behaviour may violate the RFC for 304 Not Modified Response.
If a cache uses a received 304 response to update a cache entry, the cache MUST update the entry to reflect any new field values given in the response. 
As I understand this, the cache MUST update the entry fields, which in this case are only headers since origin does not resend the body.
I would like to ask if this behaviour is correct and my interpretation of the RFC is wrong, or if this behaviour is really intended or there is a bug somewhere else.
More information about the nginx-devel