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

Proxy support #17

Open
axel3rd opened this issue Jul 16, 2020 · 0 comments
Open

Proxy support #17

axel3rd opened this issue Jul 16, 2020 · 0 comments

Comments

@axel3rd
Copy link

axel3rd commented Jul 16, 2020

Using docsify-to-pdf-converter behind a (company) proxy could be a little tricky, mainly due to puppeteer:

  1. For chromium package download via NPM
  2. For configuring proxy & authentication for puppeteer rendering (some resource like https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.11/lodash.min.js are required)

About [1], you should proxify https://storage.googleapis.com remote endpoint (with Nexus, Artifactory, ...) and configure puppeteer host download with you internal endpoint:

npm config set puppeteer_download_host http://repo.company.com/google-storage-remote

This item could perhaps be mentionned into readme.md


About [2], it requires feature development in render.js with new configuration options:

proxyHost: "proxy.company.com:8080", // Optional company proxy host
proxyUser: "foo", // Optional user for proxy authentication
proxyPassword: "bar", // Optional password for proxy user

When setted, these options should be used as below (details in #2234) ;

  • proxy host:

const browser = await puppeteer.launch({
defaultViewport: {
width: 1200,
height: 1000,
},
});

==>

 const browser = await puppeteer.launch({ 
   defaultViewport: { 
     width: 1200, 
     height: 1000, 
   },
   args: [ '--proxy-server=proxy.company.com:8080' ]
 }); 
  • proxy authentication:

const page = await browser.newPage();
await page.goto(docsifyUrl, { waitUntil: "networkidle0" });

==>

 const page = await browser.newPage(); 
 await page.authenticate({
      username: 'foo',
      password: 'bar'
  });
 await page.goto(docsifyUrl, { waitUntil: "networkidle0" }); 
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

1 participant