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

[Bug]: Incognito browser context doesn't respect proxyServer option #8820

Open
vickyRathee opened this issue Aug 21, 2022 · 4 comments
Open

Comments

@vickyRathee
Copy link

Bug description

Steps to reproduce the problem:

Example 1

Launch browser with proxy server

return await puppeteer.launch({
      headless: headless,
      executablePath: CHROMIUM_PATH,
      ignoreHTTPSErrors: true,
      args: [
        `--proxy-server=${process.env.PROXY_SERVER}`,
        "--no-sandbox",
        "--disable-setuid-sandbox",
      ],
    });

Create a context without proxy

const context = await browser.createIncognitoBrowserContext({
              proxyServer: undefined,
            });
const page = await context.newPage();
await page.goto("https://example.com");

-- Throw error : proxy authentication required

I want to skip proxy inherited from browser instance, so set the proxyServer: undefined for this context.

But the context page still asking for proxy authentication, which means it's not respecting the proxyServer option set in create and just inheriting it from the browser anonymously.

Example 2

It doesn't work vice-versa as well,

Launch browser without proxy server

return await puppeteer.launch({
      headless: headless,
      executablePath: CHROMIUM_PATH,
      ignoreHTTPSErrors: true,
      args: [
        "--no-sandbox",
        "--disable-setuid-sandbox",
      ],
    });

Create a context with proxy

const context = await browser.createIncognitoBrowserContext({
              proxyServer: process.env.PROXY_SERVER,
            });
const page = await context.newPage();
await page.goto("https://example.com");

Same goes vice-versa. I am setting the proxyServer option set in create context, but it's not setting the proxy and inheriting from browser level causing no proxy applied.

So we are forced to launch 2 browser

  1. With proxy in launch argument
  2. Without proxy in launch argument

Due to the proxyServer option is useless in creating context.

Puppeteer version

16.2.0

Node.js version

16.14.0

npm version

7.20.0

What operating system are you seeing the problem on?

Windows

Relevant log output

No response

@OrKoN
Copy link
Collaborator

OrKoN commented Aug 22, 2022

It does sound a lot like https://crbug.com/1310057 which is an upstream issue in Chromium, that does not respect the proxy settings on Windows.

@vickyRathee
Copy link
Author

@OrKoN What about vice-versa, is that also related to windows only due to upstream?

I mean - when I don't set proxy in launch arguments but trying to use proxy in context by passing proxyServer

@OrKoN
Copy link
Collaborator

OrKoN commented Aug 22, 2022

@vickyRathee yes, I believe the proxyServer param in createIncognitoBrowserContext is completely ignored on Windows.

@sequencerr
Copy link

Not working on Linux(Debian) (vmware) for me either. #678 (comment)

const context = await browserInstance.createIncognitoBrowserContext({
	proxyServer: 'http://***:80'
});
const page = await context.newPage();
await page.authenticate({ username: '***', password: '***' });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants