Opened 15 years ago

Closed 10 years ago

Last modified 10 years ago

#13755 closed Bug (fixed)

HttpRequest.is_ajax() should be used together with vary_on_headers('HTTP_X_REQUESTED_WITH')

Reported by: Miloslav Pojman Owned by: nobody
Component: Documentation Version: 1.0
Severity: Normal Keywords:
Cc: miloslav.pojman@… 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

Sending different response depending on HttpRequest.is_ajax() breaks Django cache middleware (an possibly others).

Easy fix is use vary_on_headers('HTTP_X_REQUESTED_WITH') decorator and I think this practice should be documented near is_ajax method http://docs.djangoproject.com/en/1.2/ref/request-response/#django.http.HttpRequest.is_ajax

Attachments (1)

13755.diff (844 bytes ) - added by Tim Graham 10 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 by Russell Keith-Magee, 15 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Miloslav Pojman, 14 years ago

Cc: miloslav.pojman@… added

comment:3 by Julien Phalip, 14 years ago

Severity: Normal
Type: Bug

comment:4 by Aymeric Augustin, 13 years ago

UI/UX: unset

Change UI/UX from NULL to False.

comment:5 by Aymeric Augustin, 13 years ago

Easy pickings: unset

Change Easy pickings from NULL to False.

by Tim Graham, 10 years ago

Attachment: 13755.diff added

comment:6 by Tim Graham, 10 years ago

Has patch: set

comment:7 by Claude Paroz, 10 years ago

Triage Stage: AcceptedReady for checkin

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

Resolution: fixed
Status: newclosed

In db9a1a0c47cacb9fa4ba7a39ffedeecf4e672223:

Fixed #13755 -- Added a tip for caching responses that vary on AJAX.

Thanks mila for the suggestion.

comment:9 by Tim Graham <timograham@…>, 10 years ago

In accdc448bc5c203503cac7cce92e17c6910038ed:

[1.7.x] Fixed #13755 -- Added a tip for caching responses that vary on AJAX.

Thanks mila for the suggestion.

Backport of db9a1a0c47 from master

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