From 840a86b46ba5ba393f04155b3f563c09d043152f Mon Sep 17 00:00:00 2001 From: Mark Fee Date: Thu, 23 Nov 2023 13:00:57 +0000 Subject: [PATCH] FCRM-4556 added header dump to home --- server/index.js | 7 +++++++ server/routes/home.js | 6 +++++- server/views/home.html | 5 +++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/server/index.js b/server/index.js index 40764460..a23bb978 100644 --- a/server/index.js +++ b/server/index.js @@ -54,6 +54,13 @@ async function createServer () { }) } + server.ext('onRequest', (request, h) => { + // console.log('\nonRequest.headers', request.headers) + // console.log('\nonRequest.response', request.response) + + return h.continue + }) + server.ext('onPreResponse', async (request, h) => { request.response.header('cache-control', 'no-cache') request.response.header('Strict-Transport-Security', 'max-age=31536000; includeSubDomains; preload') diff --git a/server/routes/home.js b/server/routes/home.js index df49c801..8b5382c6 100644 --- a/server/routes/home.js +++ b/server/routes/home.js @@ -6,7 +6,11 @@ module.exports = [{ description: 'Home Page', handler: async (request, h) => { if (typeof request.yar === 'undefined' || typeof request.yar.get('displayError') === 'undefined') { - return h.view('home', { allowRobots: true }) + // return h.view('home', { allowRobots: true, headers: JSON.stringify(request.headers) }) + const headers = JSON.stringify(request.headers) + // console.log('\nhome\ Request.headers', request.headers) + // console.log('\nhome\ Request.headers Stringified', headers) + return h.view('home', { allowRobots: true, headers: encodeURIComponent(headers) }) } else { const errMess = request.yar.get('displayError') request.yar.set('displayError', {}) diff --git a/server/views/home.html b/server/views/home.html index cd2dfd83..66f1d5d9 100644 --- a/server/views/home.html +++ b/server/views/home.html @@ -135,5 +135,10 @@

+ {% endblock %}