#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 )
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 , 8 years ago
Status: | new → assigned |
---|
comment:2 by , 8 years ago
Description: | modified (diff) |
---|
comment:3 by , 8 years ago
Has patch: | set |
---|---|
Patch needs improvement: | set |
Summary: | cache.patch_response_headers() adds ETag and Last-Modified to the response → Remove patch_response_headers()'s setting of the "Last-Modified" header |
Triage Stage: | Unreviewed → Accepted |
Type: | Bug → Cleanup/optimization |
comment:4 by , 8 years ago
Patch needs improvement: | unset |
---|
comment:6 by , 7 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.
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.