Alright... I think I might have tracked it down. I think it's an issue
with "Vary: Cookie" and it appears their is a fix for making this
header only show up when the request varies on the cookie.
http://code.djangoproject.com/ticket/3586

Haven't confirmed this yet, but seem like the issue.

Matt

On Dec 4, 10:58 am, Matt <[EMAIL PROTECTED]> wrote:
> Hi. I am trying to get a JS file cached by the browser using per-view
> caching with @cache_page and/or @cache_control. But the file is not
> getting cached as I would like.
>
> I have the following scenario: A view generates a JavaScript file that
> is unique for each user. However the JS file rarely changes for a
> user.
>
> ----In view.py-----------------------
> @cache_page(37000)
> @cache_control(private=True, max_age=37000)
> def user_unique_js(request):
> -----------------------------------------
>
> When accessing the page using FireFox I can check out the HTTP headers
> and they look like the following:
> ------------------------------------------------
> HTTP/1.1 200 OK
> Date: Tue, 04 Dec 2007 14:59:43 GMT
> Server: Apache/2.2.3 (Debian) mod_python/3.2.10 Python/2.4.4 PHP/
> 5.2.0-8+etch7 mod_ssl/2.2.3 OpenSSL/0.9.8c
> Expires: Wed, 05 Dec 2007 01:16:23 GMT
> Vary: Cookie
> Last-Modified: Tue, 04 Dec 2007 14:59:43 GMT
> Etag: af0d1f45cb03ee198342ddb280f3164d
> Cache-Control: private, max-age=37000
> Content-Type: text/html; charset=utf-8
> -------------------------------------------------
>
> However, from looking at the cache using about:cache, it appears the
> JS file get reloaded each time the page is loaded.
>
> ---- From about:cache -------------------------
> last fetched: 2007-12-04 10:54:08
> last modified: 2007-12-04 10:54:04
> expires: 2007-12-04 20:16:23
> -----------------------------------------------------------
>
> The static JS files served by Apache do get cached. Their headers look
> like the following:
> ----------------------------------------------------------
> HTTP/1.1 200 OK
> Date: Tue, 04 Dec 2007 14:58:27 GMT
> Server: Apache/2.2.3 (Debian) mod_python/3.2.10 Python/2.4.4 PHP/
> 5.2.0-8+etch7 mod_ssl/2.2.3 OpenSSL/0.9.8c
> Last-Modified: Mon, 03 Dec 2007 19:59:20 GMT
> Etag: "67bf-8136-37463600"
> Accept-Ranges: bytes
> Content-Length: 33078
> Content-Type: application/x-javascript
> ----------------------------------------------------------
>
> ---- From about:cache -------------------------
> last fetched: 2007-12-04 10:54:06
> last modified: 2007-12-04 10:52:48
> expires: 2007-12-04 11:52:21
> ----------------------------------------------------------
>
> Does anyone have an idea of what the issue could? Am I attempting to
> cache the file properly?
>
> Thanks,
> Matt
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to