-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathserver.js
More file actions
26 lines (20 loc) · 734 Bytes
/
server.js
File metadata and controls
26 lines (20 loc) · 734 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
'use strict';
const prerender = require('prerender');
const prMemoryCache = require('prerender-memory-cache');
const server = prerender({
chromeFlags: ['--no-sandbox', '--headless', '--disable-gpu', '--remote-debugging-port=9222', '--hide-scrollbars', '--disable-dev-shm-usage'],
forwardHeaders: true,
chromeLocation: '/usr/bin/chromium-browser'
});
const memCache = Number(process.env.MEMORY_CACHE) || 0;
if (memCache === 1) {
server.use(prMemoryCache);
}
const s3Cache = Number(process.env.S3_CACHE) || 0;
if (s3Cache === 1) {
server.use(require('prerender-aws-s3-cache'));
}
server.use(prerender.blacklist());
server.use(prerender.httpHeaders());
server.use(prerender.removeScriptTags());
server.start();