James Brady schrieb:
> Oops - my fault: browsers DO cache URLs with query strings, "so long
> as freshness information is present"
So, it appears that the best solution is a combination of the two
approaches:
1. Generate a timestamp from the modification time of the file and
append it as a query parameter.
2. Set the "Expires" header to somewhere far in the future.
This will mean that all browsers will cache the file and when the file
changes and the query param changes, the file wil be requested again.
For 1) you can use the widget trick I mentioned.
For 2) you could use a CherryPy filter to set the "expires" header
automatically for static resources. But it would be better to serve
static files through a real web server anyway, so it depends on the web
server used how to set the "Expired" header for static files.
Here's an example for a nginx configuration:
# Set "Expires" header for all CSS and JavaScript files
location ~* \.(css|js)$ {
# 1 week
expires 168h;
}
Please note that this is all theory, you should probably test this
thoroughly before relying on it.
HTH, Chris
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---