diff --git a/packages/prerender-fargate/lib/prerender/server.js b/packages/prerender-fargate/lib/prerender/server.js index e248cc76..a4913bf2 100644 --- a/packages/prerender-fargate/lib/prerender/server.js +++ b/packages/prerender-fargate/lib/prerender/server.js @@ -72,8 +72,9 @@ if (process.env.ENABLE_REDIRECT_CACHE.toLowerCase() === 'true'){ next(); }); - }, - + }}); + server.use(prerender.removeScriptTags()); + server.use({ pageLoaded: function(req, res, next) { const statusCodesToCache = ['200', '301', '302']; var s3Metadata = {} @@ -127,7 +128,6 @@ if (process.env.ENABLE_REDIRECT_CACHE.toLowerCase() === 'true'){ }); } }); - server.use(prerender.removeScriptTags()); } else { server.use(prerender.httpHeaders()); server.use(prerender.removeScriptTags());