Skip to content
This repository has been archived by the owner on Apr 30, 2019. It is now read-only.

Commit

Permalink
Fixed some caching problems
Browse files Browse the repository at this point in the history
  • Loading branch information
akyoto committed Oct 31, 2016
1 parent 3a9ec5f commit f5fdd0e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/App/routePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,23 @@ const respond = function(code, headers, request, response) {

// This is actually faster than response.setHeader(), believe it or not.
let localHeaders = Object.assign({}, headers)
localHeaders['Cache-Control'] = 'max-age=864000'

// Force the browser to revalidate this resource
localHeaders['Cache-Control'] = 'no-cache'

// Cache key
localHeaders.ETag = etag

// Send response
response.writeHead(response.statusCode || 200, localHeaders)
response.end(codeBuffer)
}

const respondStatic = function(code, baseHeaders) {
const headers = Object.assign({}, baseHeaders)

headers['Cache-Control'] = 'no-cache'

// To gzip, or not to gzip, that is the question
if(code.length >= gzipThreshold) {
// Enable gzip
Expand Down

0 comments on commit f5fdd0e

Please sign in to comment.