chrome-prerender icon indicating copy to clipboard operation
chrome-prerender copied to clipboard

beforeSend plugin

Open knuhol opened this issue 7 years ago • 3 comments

Is there any option how to use something like beforeSend(req, res, next) plugin from NodeJS prerender or is there any plan to add this feature?

I need to modify both request and response because:

  • I need to disable cache
  • I need to add some meta tags
  • I need to modify headers

knuhol avatar Jun 14 '17 11:06 knuhol

chrome-prerender isn't designed as a library, it's an application. beforeSend isn't really applicable to an application. To support all the things you want, we need to redesign it to make it work as a library.

To disable cache, you can set environment var CACHE_BACKEND=dummy.

messense avatar Jun 14 '17 12:06 messense

To disable cache, you can set environment var CACHE_BACKEND=dummy.

Thanks, but it doesn't work for me (still getting response 304 instead of 200).

knuhol avatar Jun 14 '17 12:06 knuhol

@akarienta chrome-prerender will try to get the requested url's status code if possible. You got 304 means Chrome got 304 for that url.

https://github.com/bosondata/chrome-prerender/blob/master/prerender/chromerdp.py#L427

messense avatar Jun 14 '17 12:06 messense