Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prerender loads all the plugins in the first thread #402

Closed
tirthaguha opened this issue Jun 12, 2017 · 1 comment
Closed

prerender loads all the plugins in the first thread #402

tirthaguha opened this issue Jun 12, 2017 · 1 comment

Comments

@tirthaguha
Copy link

If you enable whitelist plugin

server.use(prerender.sendPrerenderHeader());
// server.use(prerender.basicAuth());
server.use(prerender.whitelist());
//server.use(prerender.blacklist());
// server.use(prerender.logger());
server.use(prerender.removeScriptTags());
server.use(prerender.httpHeaders());
server.use(prerender.inMemoryHtmlCache());
// server.use(prerender.s3HtmlCache());

and put a log in lib\index.js

fs.readdirSync(__dirname + '/plugins').forEach(function (filename) {
  if (!/\.js$/.test(filename)) return;
  var name = basename(filename, '.js');

  function load () {
    _console.log('-----> : index.load() ------> name: ', name);_
    return require('./plugins/' + name);
  }

  Object.defineProperty(exports, name, {value: load});
});

then the logs show that it is loading all the plugins, even the one's i didn't opt for

> prerender@4.3.1 start-local C:\WORKSPACE\NODEJS\prerender
> set ENV=development && set PRERENDER_NUM_WORKERS=2 && set CACHE_TTL=21600 && node server.js

debug: starting worker thread #0
debug: starting worker thread #1
-----> : index.load() ------> name:  sendPrerenderHeader
-----> : index.load() ------> name:  whitelist
-----> : index.load() ------> name:  removeScriptTags
-----> : index.load() ------> name:  httpHeaders
-----> : index.load() ------> name:  inMemoryHtmlCache
-----> : index.load() ------> name:  sendPrerenderHeader
-----> : index.load() ------> name:  whitelist
-----> : index.load() ------> name:  removeScriptTags
-----> : index.load() ------> name:  httpHeaders
-----> : index.load() ------> name:  inMemoryHtmlCache
debug: starting phantom...
debug: Server running on port 3000
-----> : index.load() ------> name:  sendPrerenderHeader
-----> : index.load() ------> name:  whitelist
-----> : index.load() ------> name:  removeScriptTags
-----> : index.load() ------> name:  httpHeaders
-----> : index.load() ------> name:  inMemoryHtmlCache
debug: starting phantom...
debug: Server running on port 3000
info: started phantom
info: started phantom
@thoop
Copy link
Contributor

thoop commented Jun 16, 2017

That's expected. That just sets the plugins on the prerender variable. They aren't added to your prerender server unless you call server.use

@thoop thoop closed this as completed Jun 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants