--
Ticket URL: <https://code.djangoproject.com/ticket/27225>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => assigned
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/27225#comment:1>
Comment (by timgraham):
I'm not sure if the proposed behavior is correct. From
[https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.3 RC2616
sec14.9.3] (which I only skimmed, so please provide another reference if
it's wrong):
If a response includes both an Expires header and a max-age directive,
the max-age directive overrides the Expires header, even if the Expires
header is more restrictive.
I think I understand the idea behind the
[https://github.com/django/django/pull/7246 PR], however, it seems to
treat the Expires as authoritative rather than max-age.
--
Ticket URL: <https://code.djangoproject.com/ticket/27225#comment:2>
Comment (by renskiy):
Exactly, and that's why it is a bug.
It would be correct behavior if response include '''Date''' header
corresponding to original response generation time. But I'm not sure
--
Ticket URL: <https://code.djangoproject.com/ticket/27225#comment:3>
Comment (by renskiy):
[RFC7234](https://tools.ietf.org/html/rfc7234#section-5.1) says about
'''Age''' header which indicates age of the cache, so instead of Cache-
Control's max-age regeneration it is possible to set Age. Also there is
good visual explanation how browser cache should work:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching#Freshness
--
Ticket URL: <https://code.djangoproject.com/ticket/27225#comment:4>
Comment (by timgraham):
My understanding is that the current pull request fix isn't correct then,
right?
--
Ticket URL: <https://code.djangoproject.com/ticket/27225#comment:5>
Comment (by renskiy):
Yes, it isn't. I'm going to fix it soon.
--
Ticket URL: <https://code.djangoproject.com/ticket/27225#comment:6>
Comment (by renskiy):
Ready. Changed behavior: '''FetchFromCacheMiddleware''' sets Age header
now.
--
Ticket URL: <https://code.djangoproject.com/ticket/27225#comment:7>
* has_patch: 0 => 1
* stage: Unreviewed => Accepted
Comment:
[https://github.com/django/django/pull/7246 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/27225#comment:8>
* needs_better_patch: 0 => 1
Comment:
I left comments for improvement on the PR. Please uncheck "Patch needs
improvement" after updating it.
--
Ticket URL: <https://code.djangoproject.com/ticket/27225#comment:9>
* owner: Rinat Khabibiev => Alexander Lazarević
Comment:
Created a new (draft) PR: https://github.com/django/django/pull/17726
This one contains not yet all recommended changes from the original PR:
https://github.com/django/django/pull/7246
--
Ticket URL: <https://code.djangoproject.com/ticket/27225#comment:10>
* needs_better_patch: 1 => 0
Comment:
I updated the PR
--
Ticket URL: <https://code.djangoproject.com/ticket/27225#comment:11>
It's not blocked by #35141 anymore
--
Ticket URL: <https://code.djangoproject.com/ticket/27225#comment:12>
* summary:
Cache-Control's max-age doesn't match Expires for responses taken from
cache
=> "age" header is not set for responses taken from cache.
--
Ticket URL: <https://code.djangoproject.com/ticket/27225#comment:13>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/27225#comment:14>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"3580b47ed31ec85ae89b13618f36bb463e97acc8" 3580b47e]:
{{{#!CommitTicketReference repository=""
revision="3580b47ed31ec85ae89b13618f36bb463e97acc8"
Fixed #27225 -- Added "Age" header when fetching cached responses.
Co-Authored-By: Author: Alexander Lazarević <la...@e11bits.com>
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/27225#comment:15>