From d522030366e04739b32c829ab4be00616b953f1e Mon Sep 17 00:00:00 2001 From: Gunananthaa K B <cb.en.u4cse19021@cb.students.amrita.edu> Date: Sun, 15 May 2022 13:11:16 +0530 Subject: [PATCH] mod in static file --- proxy/proxy.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/proxy/proxy.js b/proxy/proxy.js index f60eee6..2073643 100644 --- a/proxy/proxy.js +++ b/proxy/proxy.js @@ -25,8 +25,9 @@ const requestListener = (req,res)=>{ if(filter(req)){ const get = http.get(options,response=>{ - console.log(`statusCode: ${response.statusCode}`); + // console.log(`statusCode: ${response.statusCode}`); if(response.statusCode===304){ + console.log("Serving this request from Cache."); res.setHeader("Content-Type", "text/html"); res.writeHead(200); res.end(cache); @@ -34,6 +35,7 @@ const requestListener = (req,res)=>{ else{ let buffer=""; // console.log(`Last modified: ${JSON.stringify(response.headers['last-modified'] )}`); + console.log("Content seems modified. Serving new and storing in cache"); lastModified = new Date(JSON.parse(response.headers['last-modified'])); console.log(`Last modified; ${lastModified}`); response.on('data',d=>{buffer+=d}); -- GitLab