gzipping responses from express

9 views
Skip to first unread message

Ian Petzer

unread,
Dec 17, 2013, 3:50:46 AM12/17/13
to nod...@googlegroups.com
Hello Ct Noders,

For my Express app, I've switched on the connect middleware for gzip compression using:
app.use(express.compress());

However, it seems to me that the responses are gzipped every time. Does anyone have any advice on how I can gzip my static assets in advance?

Or will the middleware only do it once and cache this for me.

I'm struggling to find info on this on the net. 

See you all later this eve!

Ian


 

Adrian Rossouw

unread,
Dec 17, 2013, 4:28:22 AM12/17/13
to nod...@googlegroups.com
i serve everything through nginx, and do the caching configuration on that level.

it is a lot more straight forward to me than sticking all that stuff into my 
application code for me.

Rudolf Meijering

unread,
Dec 17, 2013, 2:39:40 PM12/17/13
to nod...@googlegroups.com
The source code is here: 

As you can see, no caching. The static middleware, however will probably cache the compressed response, once again, the source code is the best documentation. Just make sure of the order of your middleware.


--
You received this message because you are subscribed to the Google Groups "Node Cape Town" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodecpt+u...@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
Visit this group at http://groups.google.com/group/nodecpt.
For more options, visit https://groups.google.com/groups/opt_out.



--
Rudolf Meijering
Reply all
Reply to author
Forward
0 new messages