Skip to content

Add Expires header to 'static' Middleware #410

bminer opened this Issue Nov 11, 2011 · 5 comments

4 participants

bminer commented Nov 11, 2011

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.

bminer commented Nov 11, 2011

Something like this might work:

var d = new Date().getTime() + maxAge;
res.setHeader('Expires', new Date(d).toUTCString() );
@ryanrolds ryanrolds added a commit to ryanrolds/connect that referenced this issue Nov 19, 2011
@ryanrolds ryanrolds Added Expires header (max one year) for #410 e10844e
saich commented Nov 29, 2011

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?

bminer commented Nov 29, 2011

@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.