Express middleware to introduce proper cache headers

30 views
Skip to first unread message

Kevin Ingwersen (Ingwie Phoenix)

unread,
Jun 18, 2015, 11:47:02 AM6/18/15
to nod...@googlegroups.com
Hey there, guys!

I am struggling, trying to get caching right on my server. I currently use the „st“ module for serving static files to my client. But now I want to add the correct headers to it. The thing is, that when using ETag headers, the client always does a verification request… and that sucks. I want to do as few requests as possible.

The current state of it all can be tested here http://dev.dragonsinn.tk and the code that builds up the web server http://git.ingwie.me/ingwie/bird3/blob/master/node-lib/front-end/request_handler.js

Can anyone recommend a good aproach for doing proper caching? I plan on setting up a varnish cache in the long run, but i want to only use NodeJS for now.

Kind regards, Ingwie

Ryan Graham

unread,
Jun 18, 2015, 6:13:26 PM6/18/15
to nod...@googlegroups.com
You need to set the appropriate cache control headers for the client to know that it doesn't even need to make a conditional request.


~Ryan

--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/8C173AF7-E6D1-4FCC-9B0D-C713BCB40CD9%40googlemail.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages