Opened 8 years ago

Closed 8 years ago

Last modified 6 years ago

#27226 closed Cleanup/optimization (fixed)

Remove patch_response_headers()'s setting of the "Last-Modified" header

Reported by: Rinat Khabibiev Owned by: Rinat Khabibiev
Component: HTTP handling Version: 1.10
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
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)

cache.patch_response_headers() adds ETag and Last-Modified headers to the response while it is not it's responsibility. There are etag and last_modified decorators in django.views.decorators.http module to work with such headers.

Change History (6)

comment:1 by Rinat Khabibiev, 8 years ago

Status: newassigned

comment:2 by Rinat Khabibiev, 8 years ago

Description: modified (diff)

comment:3 by Tim Graham, 8 years ago

Has patch: set
Patch needs improvement: set
Summary: cache.patch_response_headers() adds ETag and Last-Modified to the responseRemove patch_response_headers()'s setting of the "Last-Modified" header
Triage Stage: UnreviewedAccepted
Type: BugCleanup/optimization

The ETag removal will go through a deprecation in #26447 so this ticket is limited to removing the Last-Modified header. There's some discussion on the PR about whether or not removing it could result in behavior changes.

comment:4 by Tim Graham, 8 years ago

Patch needs improvement: unset

comment:5 by Tim Graham <timograham@…>, 8 years ago

Resolution: fixed
Status: assignedclosed

In 9e07a9b:

Fixed #27226 -- Removed patch_response_headers()'s setting of the Last-Modified header.

comment:6 by Josh Smeaton, 6 years ago

For future visitors, this change breaks the default Akamai caching configuration which depends on a Last-Modified header. Akamai also allows opting in to ETag based caching strategies, but it is not the default. To fix Akamai caching, you'll need to add the Last-Modified header to the response:

from django.utils.http import http_date
if not response.has_header('Last-Modified'):
    response['Last-Modified'] = http_date()

Note: See TracTickets for help on using tickets.
Back to Top