summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md5
-rw-r--r--index.js4
2 files changed, 8 insertions, 1 deletions
diff --git a/README.md b/README.md
index 7432021..b5459db 100644
--- a/README.md
+++ b/README.md
@@ -5,4 +5,7 @@
# How to use
Send your request to the server with the port 3000 and add your URL to the "url" query string like this:
-`http://localhost:3000/?url=https://example.org` \ No newline at end of file
+`http://localhost:3000/?url=https://example.org`
+
+To show the browser window, set the environment variable `PUPPETEER_HEADFUL=1`. To use a proxy,
+set the `PUPPETEER_PROXY` environment variable, for example `PUPPETEER_PROXY=localhost:8080`.
diff --git a/index.js b/index.js
index 1d2a8f4..3fd1d00 100644
--- a/index.js
+++ b/index.js
@@ -20,6 +20,10 @@ const responseHeadersToRemove = ["Accept-Ranges", "Content-Length", "Keep-Alive"
};
if (process.env.PUPPETEER_SKIP_CHROMIUM_DOWNLOAD)
options.executablePath = '/usr/bin/chromium-browser';
+ if (process.env.PUPPETEER_HEADFUL)
+ options.headless = false;
+ if (process.env.PUPPETEER_PROXY)
+ options.args.push(`--proxy-server=${process.env.PUPPETEER_PROXY}`);
const browser = await puppeteer.launch(options);
app.use(async ctx => {
if (ctx.query.url) {