Forum OpenACS Development: Re: css and js versioning by url to avoid caching old ones

Rocael, below is the very simple patch for adding expires
to files in the resources directory. No, we are not using etags. 

Miguel, concerning CVS and filenames, i agree that a link 
sounds better to keep history. To keep maintenance low, 
one could write a small script and use maybe a tag in cvs
to create from the tag and the file-name a link... 

On the  other hand, if these resources are only changed when
the  version numbers of packages are upgraded, it would be quite 
easy to add the package_version to the resources path 
(similar to the yahoo YUI APIs approach)
http://.../resources/xowiki/0.88/xowiki.css 
such a change will lead to practically zero maintenance cost, 
the expires can be set to high values. Just people with
reverse proxies will not be to happy about this...

-gustaf neumann


===================================================================
RCS file: /cvsroot/openacs-4/packages/acs-tcl/tcl/request-processor-procs.tcl,v
retrieving revision 1.91
diff -u -r1.91 request-processor-procs.tcl
--- request-processor-procs.tcl    12 Oct 2007 07:33:45 -0000    1.91
+++ request-processor-procs.tcl    10 Jul 2008 22:27:03 -0000
@@ -488,6 +488,8 @@
         set path "[acs_root_dir]/www/resources/[join [lrange [ns_conn urlv] 1 end] /]"
     }
     if { [file isfile $path] } {
+        # set expires header to 15 Minutes
+        ns_setexpires 900
         ns_returnfile 200 [ns_guesstype $path] $path
         return filter_return
     } else {