prerender / prerender

Node server that uses Headless Chrome to render a javascript-rendered page as HTML. To be used in conjunction with prerender middleware.
MIT License
6.46k stars 924 forks source link

blockResources not working? #777

Open maraboshi opened 7 months ago

maraboshi commented 7 months ago

Hi,

We have server.use(prerender.blockResources()); in prerender.js a list of blocked resources in lib/plugins/blockResources.js (those in this repo plus a couple of other websites).

I start with everything clear: new deployment for the prerender app, Varnish restarted.

I request a page, I see Varnish serving the images to Headless Chrome, causing unnecessary traffic.

Can you please help and point us to the right direction?

Thank you!

johnroper100 commented 7 months ago

I'm having the same issue

maraboshi commented 7 months ago

I'm having the same issue

I think we might have solved a part of the problem by adding the following flag in chrome (you might have to redeploy to have effect)

--blink-settings=imagesEnabled=false

in the relevant section https://github.com/prerender/prerender/blob/478fa6d0a5196ea29c88c69e64e72eb5507b6d2c/lib/browsers/chrome.js#L35

apparently, as it is, this whole blockResources thing is supposed to only prevent chrome to process the response but the requests are still being done and generating unnecessary network usage.

johnroper100 commented 7 months ago

That does seem to be speeding it up a bit