Skip to content

Commit

Permalink
Merge pull request #780 from prerender/feat/extra-chrome-flags
Browse files Browse the repository at this point in the history
feat: add option extraChromeFlags and proxyServer
  • Loading branch information
avelinesg committed Apr 17, 2024
2 parents 478fa6d + 776aa15 commit c6b7bed
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## 5.20.3 - 2024-04-17
### Changed
- Add `proxyServer` option to allow for a proxy server to be used by Headless Chrome
- Add `extraChromeFlags` option to add additional Chrome flags without overriding the default flags

## 5.20.2 - 2023-03-01
- Add `x-prerender-render-id` and `x-prerender-render-at` meta tags to header

Expand Down
11 changes: 9 additions & 2 deletions lib/browsers/chrome.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,19 @@ chrome.spawn = function (options) {
return reject();
}

this.chromeChild = spawn(location, this.options.chromeFlags || [
const chromeFlags = this.options.chromeFlags || [
'--headless',
'--disable-gpu',
'--remote-debugging-port=' + this.options.browserDebuggingPort,
'--hide-scrollbars',
], {shell: true});
];

if (!this.options.chromeFlags) {
if (this.options.extraChromeFlags) chromeFlags = chromeFlags.concat(this.options.extraChromeFlags);
if (this.options.proxyServer) chromeFlags.push('--proxy-server=' + this.options.proxyServer);
}

this.chromeChild = spawn(location, chromeFlags, {shell: true});

resolve();
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"author": "Prerender.io",
"name": "prerender",
"description": "Service to prerender Javascript rendered pages for SEO",
"version": "5.20.2",
"version": "5.20.3",
"license": "MIT",
"repository": {
"type": "git",
Expand Down

0 comments on commit c6b7bed

Please sign in to comment.