From 2bd532bc20453c42497446678caf362dcfb9cb72 Mon Sep 17 00:00:00 2001 From: Simon Tokumine Date: Thu, 8 Dec 2011 02:22:44 +0000 Subject: [PATCH] add experimental varnish headers --- app/controllers/app.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/controllers/app.js b/app/controllers/app.js index 27ad51f0..918d6484 100755 --- a/app/controllers/app.js +++ b/app/controllers/app.js @@ -55,6 +55,10 @@ function handleQuery(req, res){ res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "X-Requested-With"); + // set cache headers + res.header('Last-Modified', new Date().toUTCString()); + res.header('Cache-Control', 'no-cache,max-age=3600,must-revalidate, public'); + try { if (!_.isString(sql)) throw new Error("You must indicate a sql query"); var pg; @@ -70,6 +74,7 @@ function handleQuery(req, res){ function setDBGetUser(err, data) { if (err) throw err; database = (data == "" || _.isNull(data)) ? database : data; + res.header('X-Cache-Channel', database); oAuth.verifyRequest(req, this); }, function querySql(err, user_id){