Re: Supporting cache control for static files with cgi/server mode
"John P. Rouillard" <[email protected]>
| Newsgroups | gmane.comp.bug-tracking.roundup.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi all: In message <[email protected]>, "John P. Rouillard" writes: >I have been trying to get css, js (and other files) to be cached >client side. I usually run a front end web server (hiawatha) that >reverse proxies to the roundup-server. > [...] >So I have been looking at what it would take to make the native >Client::serve_file (for attachments/messages) or >Client::serve_static_file (@@file/) set caching headers. > >I am considering two ways to configure this: > > 1) in config.ini add a new section [cache-control] with file > extensions as keys. So: > > [cache] > js = public, max-age=86400 > css = public, max-age=2419200 > rss = no-cache > * = immutable ; used for file attachments/messages > > [...] > > 2) define a new dict in the cgi/client.py::Client class: > > Cache_Control = {} > > Use interfaces.py to set the values in that dict. Keys/values > same as in the ini file implementation. [...] This has been implemented as in #2 with two changes. The lookup key is the mime type for the static file not the file extension. Specific file names can be added as keys and they take priority. Support for setting the header for file or message content has not been implemented. I have not added support for managing an expires header. I also added a new section to doc/customing.txt describing how to use interfaces.py as that is used to configure Cache_Control. Would somebody take a look through the new section and if you have some other examples for interfaces.py feel free to add it or send me patches. Thanks. -- -- rouilj John Rouillard =========================================================================== My employers don't acknowledge my existence much less my opinions.