Skip to content

Instantly share code, notes, and snippets.

@lanceon
Created October 20, 2014 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lanceon/99b906226c4111c91b35 to your computer and use it in GitHub Desktop.
Save lanceon/99b906226c4111c91b35 to your computer and use it in GitHub Desktop.
Always specify an Expires header. It will normally be set to -1 for immediate expiration of HTML pages or a date well into the future for other resources such as images, CSS and Javascript.
In practice, caching ‘forever’ typically means setting an Expires header value of Sun, 17-Jan-2038 19:14:07 GMT since that’s the maximum value supported by the 32 bit Unix time/date format. If you’re using IIS6 you’ll find that the UI won’t allow anything beyond 31-Dec-2035.
Use Cache-Control: no-cache for dynamic HTML pages
Use the Last-Modified header with the current file time for static HTML
For all other file types set an Expires header to the maximum future date your web server will allow
"All HTTP date/time stamps MUST be represented in Greenwich Mean Time (GMT), without exception."
Thus, any server sending timestamps in the HTTP headers, which are not sent in GMT would be considered defective.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment