Skip to content

Commit

Permalink
DO-1557: Send 'X-Prerender' along with the prerender requests
Browse files Browse the repository at this point in the history
  • Loading branch information
krishanthisera committed Oct 23, 2023
1 parent bc8b3e7 commit c5c33a7
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/prerender-fargate/lib/prerender/server.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
/**
* This file defines a Prerender server that uses AWS S3 cache to cache prerendered pages.
* It also includes middleware to handle authentication, append a custom header to indicate the response is from Prerender,
* and remove script tags from the prerendered content.
* @requires prerender
* @requires crypto
* @requires prerender-aws-s3-cache
* @requires he
* @requires aws-sdk
* @requires fs
*/
'use strict';

const prerender = require('prerender');
Expand Down Expand Up @@ -44,6 +55,9 @@ server.use({

server.use(prerender.blacklist());

// Send 'X-Prerender': '1'
server.use(prerender.sendPrerenderHeader());

if (process.env.ENABLE_REDIRECT_CACHE.toLowerCase() === 'true'){
var he = require('he');
var s3 = new (require('aws-sdk')).S3({params:{Bucket: process.env.S3_BUCKET_NAME}});
Expand Down

0 comments on commit c5c33a7

Please sign in to comment.