staticCache broken #631

ruxkor opened this Issue Jul 16, 2012 · 5 comments


None yet
4 participants

ruxkor commented Jul 16, 2012

The staticCache middleware is broken since the first commit after 2.3.6, commit 3ea7fa2f74

The reason for this is the switching to TJ's send module which does not emit the static event any more. This event is used in staticCache to activate the actual caching.

Either fixing it or removing it altogether (since it is already deprecated and will stop working in connect >= 3) would be a solution.


tj commented Jul 16, 2012

yeah it's tempting to just noop it for now

seasoup commented Aug 28, 2012

Hey guys, how come you no longer emit a 'static' event when serving a static page? I was using this to do things whenever a static file was being served, is there a new way to be doing this? Thanks.


tj commented Aug 28, 2012

the static event was just a stupid hack to get staticCache working

seasoup commented Aug 28, 2012

It's ok, I found another way to do what I wanted. I was doing:

app.configure( function () {
app.use( function ( req, res, next ) {
req.on( 'static', function () {
setWatch( req.url );

and am now doing:

app.configure( function () {
app.use( function ( req, res, next ) {
if (req.url.indexOf( '/js/' ) >= 0 || req.url.indexOf( '/css/' ) >= 0 ) {
setWatch( req.url );

which seems better anyway. Thanks for the response.


jonathanong commented Oct 18, 2013

staticCache will be removed in v3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment