Welcome! Log In Create A New Profile


NGINX does not update cache entry headers on 304 response

Ladislav Macoun
January 03, 2020 06:06AM
Hello list,

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.”[1]

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. [2]

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.

[1] https://github.com/nginx/nginx/commit/1ac2693a33bb65c6b0d777584ad8024aa743ee88
[2] https://tools.ietf.org/html/rfc2616#section-10.3.5

Yours faithfully,
Ladislav Macoun

nginx-devel mailing list
Subject Author Views Posted

NGINX does not update cache entry headers on 304 response

Ladislav Macoun 171 January 03, 2020 06:06AM

Re: NGINX does not update cache entry headers on 304 response

Maxim Dounin 97 January 03, 2020 06:02PM

Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 72
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready