[Django] #27225: Cache-Control's max-age doesn't match Expires for responses taken from cache

22 views
Skip to first unread message

Django

unread,
Sep 15, 2016, 12:13:40 AM9/15/16
to django-...@googlegroups.com
#27225: Cache-Control's max-age doesn't match Expires for responses taken from
cache
-------------------------------+---------------------
Reporter: renskiy | Owner: renskiy
Type: Bug | Status: new
Component: HTTP handling | Version: 1.10
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+---------------------
When fetching response from the cache, 'Cache-Control' contains 'max-age'
corresponding to the moment of original response generation time, thus for
another time it usually doesn't match 'Expires' value.

--
Ticket URL: <https://code.djangoproject.com/ticket/27225>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Sep 15, 2016, 12:14:10 AM9/15/16
to django-...@googlegroups.com
#27225: Cache-Control's max-age doesn't match Expires for responses taken from
cache
-------------------------------+--------------------------------------
Reporter: renskiy | Owner: renskiy
Type: Bug | Status: assigned

Component: HTTP handling | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by renskiy):

* status: new => assigned
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/27225#comment:1>

Django

unread,
Sep 15, 2016, 2:59:07 PM9/15/16
to django-...@googlegroups.com
#27225: Cache-Control's max-age doesn't match Expires for responses taken from
cache
-------------------------------+--------------------------------------
Reporter: renskiy | Owner: renskiy
Type: Bug | Status: assigned

Component: HTTP handling | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

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>

Django

unread,
Sep 15, 2016, 3:12:35 PM9/15/16
to django-...@googlegroups.com
#27225: Cache-Control's max-age doesn't match Expires for responses taken from
cache
-------------------------------+--------------------------------------
Reporter: renskiy | Owner: renskiy
Type: Bug | Status: assigned

Component: HTTP handling | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

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>

Django

unread,
Sep 16, 2016, 3:40:22 AM9/16/16
to django-...@googlegroups.com
#27225: Cache-Control's max-age doesn't match Expires for responses taken from
cache
-------------------------------+--------------------------------------
Reporter: renskiy | Owner: renskiy
Type: Bug | Status: assigned

Component: HTTP handling | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

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>

Django

unread,
Sep 16, 2016, 8:03:14 PM9/16/16
to django-...@googlegroups.com
#27225: Cache-Control's max-age doesn't match Expires for responses taken from
cache
-------------------------------+--------------------------------------
Reporter: renskiy | Owner: renskiy
Type: Bug | Status: assigned

Component: HTTP handling | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

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>

Django

unread,
Sep 18, 2016, 1:19:09 AM9/18/16
to django-...@googlegroups.com
#27225: Cache-Control's max-age doesn't match Expires for responses taken from
cache
-------------------------------+--------------------------------------
Reporter: renskiy | Owner: renskiy
Type: Bug | Status: assigned

Component: HTTP handling | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by renskiy):

Yes, it isn't. I'm going to fix it soon.

--
Ticket URL: <https://code.djangoproject.com/ticket/27225#comment:6>

Django

unread,
Sep 18, 2016, 3:00:37 PM9/18/16
to django-...@googlegroups.com
#27225: Cache-Control's max-age doesn't match Expires for responses taken from
cache
-------------------------------+--------------------------------------
Reporter: renskiy | Owner: renskiy
Type: Bug | Status: assigned

Component: HTTP handling | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by renskiy):

Ready. Changed behavior: '''FetchFromCacheMiddleware''' sets Age header
now.

--
Ticket URL: <https://code.djangoproject.com/ticket/27225#comment:7>

Django

unread,
Sep 19, 2016, 6:02:42 AM9/19/16
to django-...@googlegroups.com
#27225: Cache-Control's max-age doesn't match Expires for responses taken from
cache
-------------------------------+------------------------------------
Reporter: renskiy | Owner: renskiy
Type: Bug | Status: assigned

Component: HTTP handling | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by timgraham):

* 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>

Django

unread,
Oct 5, 2016, 12:21:00 PM10/5/16
to django-...@googlegroups.com
#27225: Cache-Control's max-age doesn't match Expires for responses taken from
cache
-------------------------------------+-------------------------------------
Reporter: Rinat Khabibiev | Owner: Rinat
| Khabibiev
Type: Bug | Status: assigned

Component: HTTP handling | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* 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>

Django

unread,
Jan 12, 2024, 1:40:01 AMJan 12
to django-...@googlegroups.com
#27225: Cache-Control's max-age doesn't match Expires for responses taken from
cache
-------------------------------------+-------------------------------------
Reporter: Rinat Khabibiev | Owner: Alexander
| Lazarević
Type: Bug | Status: assigned

Component: HTTP handling | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Alexander Lazarević):

* 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>

Django

unread,
Jan 29, 2024, 5:03:30 PMJan 29
to django-...@googlegroups.com
#27225: Cache-Control's max-age doesn't match Expires for responses taken from
cache
-------------------------------------+-------------------------------------
Reporter: Rinat Khabibiev | Owner: Alexander
| Lazarević
Type: Bug | Status: assigned
Component: HTTP handling | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Alexander Lazarević):

* needs_better_patch: 1 => 0

Comment:

I updated the PR
--
Ticket URL: <https://code.djangoproject.com/ticket/27225#comment:11>

Django

unread,
Feb 2, 2024, 8:17:26 PMFeb 2
to django-...@googlegroups.com
#27225: Cache-Control's max-age doesn't match Expires for responses taken from
cache
-------------------------------------+-------------------------------------
Reporter: Rinat Khabibiev | Owner: Alexander
| Lazarević
Type: Bug | Status: assigned
Component: HTTP handling | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Alexander Lazarević):

It's not blocked by #35141 anymore
--
Ticket URL: <https://code.djangoproject.com/ticket/27225#comment:12>

Django

unread,
Feb 5, 2024, 6:57:36 AMFeb 5
to django-...@googlegroups.com
#27225: "age" header is not set for responses taken from cache.

-------------------------------------+-------------------------------------
Reporter: Rinat Khabibiev | Owner: Alexander
| Lazarević
Type: Bug | Status: assigned
Component: HTTP handling | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* 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>

Django

unread,
Feb 5, 2024, 7:29:22 AMFeb 5
to django-...@googlegroups.com
#27225: "age" header is not set for responses taken from cache.
-------------------------------------+-------------------------------------
Reporter: Rinat Khabibiev | Owner: Alexander
| Lazarević
Type: Bug | Status: assigned
Component: HTTP handling | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* stage: Accepted => Ready for checkin

--
Ticket URL: <https://code.djangoproject.com/ticket/27225#comment:14>

Django

unread,
Feb 5, 2024, 8:02:08 AMFeb 5
to django-...@googlegroups.com
#27225: "age" header is not set for responses taken from cache.
-------------------------------------+-------------------------------------
Reporter: Rinat Khabibiev | Owner: Alexander
| Lazarević
Type: Bug | Status: closed

Component: HTTP handling | Version: 1.10
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* 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>

Reply all
Reply to author
Forward
0 new messages