Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Add Expires header to 'static' Middleware #410

bminer opened this Issue · 5 comments

4 participants


In addition to 'Cache-Control', the 'Expires' header would be a nice add. 'Expires' is more widely supported across browsers anyway.


If you want, I can fork and submit a pull request, but since it's such a small change, I wasn't sure.


Something like this might work:

var d = new Date().getTime() + maxAge;
res.setHeader('Expires', new Date(d).toUTCString() );
@ryanrolds ryanrolds referenced this issue from a commit in ryanrolds/connect
@ryanrolds ryanrolds Added Expires header (max one year) for #410 e10844e

My understanding about the Expires is that if a cached entry has a valid expiration date the browser can reuse the content without having to contact the server at all when a page or site is revisited. That is, no unused 304 responses....

Can you confirm if I'm right? Or I missed something?


@saich - that's correct. Thanks, @ryanrolds for pull request #416


@saich, the same applies to HTTP/1.1's version of Expires, Cache-Control. Expires is deprecated in favor of Cache-Control, which allows much more fine grained control of freshness and expiration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.