Opened 8 years ago

Last modified 8 years ago

#27211 closed Bug

Include HTTP-caching headers to "304 Not Modified" responses — at Version 4

Reported by: Rinat Khabibiev Owned by: Rinat Khabibiev
Component: HTTP handling Version: 1.10
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Rinat Khabibiev)

Most browsers can cache responses with 304 HTTP code. So why not to include such headers to response if necessary.

UPDATE:
According to the RFC7232 all "304 Not Modified" responses must include "Cache-Control" and "Expires" headers that would have been sent in a corresponding "200 OK" response.

See Section 4.1 of RFC7232

Change History (4)

comment:1 by Tim Graham, 8 years ago

Component: Core (Cache system)HTTP handling

I didn't spot a reason for the behavior in the original ticket (#580). Can you motivate this change with an example? You say "most browsers can cache responses with 304 HTTP code" -- any idea why all browsers don't?

comment:2 by Rinat Khabibiev, 8 years ago

The server generating a 304 response MUST generate any of the
following header fields that would have been sent in a 200 (OK)
response to the same request: Cache-Control, Content-Location, Date,
ETag, Expires, and Vary.

Taken from RFC7232: https://tools.ietf.org/html/rfc7232#section-4.1.

Usually responses with 200 code will include such headers (e.g. from views decorated with cache_page), so according to the RFC responses with 304 code must also include them.

comment:3 by Rinat Khabibiev, 8 years ago

Status: newassigned

comment:4 by Rinat Khabibiev, 8 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top