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

fix: Inherit browser-level proxy settings from incognito context #7770

Merged
merged 3 commits into from Mar 7, 2022

Conversation

jimmydief
Copy link
Contributor

What kind of change does this PR introduce?

This fixes #7589 which was a regression caused by #7516 and released in 10.4.0. It closes #7677 which fixed part of the issue but did not cover the proxy bypass list and also did not include tests.

Did you add tests for your changes?

Yes.

If relevant, did you update the documentation?

N/A

Summary

Browser-level proxy settings are now once again respected when creating new incognito browser contexts. Browser-level settings can be overridden at the context level. Tests were added for request proxy behavior in general.

Does this PR introduce a breaking change?

Nope.

Other information

N/A

@google-cla google-cla bot added the cla: no label Nov 11, 2021
@@ -319,7 +319,7 @@ export class Browser extends EventEmitter {
async createIncognitoBrowserContext(
options: BrowserContextOptions = {}
): Promise<BrowserContext> {
const { proxyServer = '', proxyBypassList = [] } = options;
const { proxyServer, proxyBypassList } = options;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Omitting the defaults here causes the browser-level settings to be respected if these aren't provided.

) => {
proxiedRequestUrls.push(originalRequest.url as string);

const proxyRequest = http.request(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Creating a simple proxy server which forwards requests on to the TestServer.

@jimmydief jimmydief closed this Nov 15, 2021
@jimmydief jimmydief reopened this Nov 15, 2021
@jimmydief
Copy link
Contributor Author

You are missing the cla https://github.com/puppeteer/puppeteer/blob/7c0a7b92cf98033425b78e1e7a96bb440a636123/CONTRIBUTING.md#contributor-license-agreement

Screen Shot 2021-11-15 at 9 55 58 AM

Signed it after opening the PR, seems like updating the status check might require some manual step.

@google-cla google-cla bot added cla: yes and removed cla: no labels Dec 1, 2021
@Momotoculteur
Copy link

Hello guys :)

Any news from this PR ? I need it for my project, i cannot upgrade anymore then my pptr version.

Thank in advance,
Bastien

@Niek
Copy link

Niek commented Feb 14, 2022

Ping @OrKoN @nschonni

Copy link
Collaborator

@OrKoN OrKoN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the new tests will be failing in Firefox as expected. Could you please add itFailsFirefox instead of it for those tests?

@jimmydief
Copy link
Contributor Author

@OrKoN The test failure on Windows actually seems to be pointing out the issue reported in #7873, #7719, and #7698. I put it behind itFailsWindows for now and left a comment referring to those issues.

@iJoris
Copy link

iJoris commented Feb 23, 2022

@jimmydief, closed that issue already.

If you need testing on windows, hit me up.

@jimmydief
Copy link
Contributor Author

@jimmydief, closed that issue already.

If you need testing on windows, hit me up.

@iJoris Gotcha, thanks. The only test that was failing was related to createIncognitoBrowserContext with the proxyServer argument provided. Could you confirm whether the example from #7698 fails on your Windows machine?

@iJoris
Copy link

iJoris commented Feb 24, 2022

@jimmydief, closed that issue already.
If you need testing on windows, hit me up.

@iJoris Gotcha, thanks. The only test that was failing was related to createIncognitoBrowserContext with the proxyServer argument provided. Could you confirm whether the example from #7698 fails on your Windows machine?
Hi,

I can confirm that the proxy server and an createIncognitoBrowserContext do not work after 10.2. Seems that the proxyServer gets ignored in an incognitoBrowserContext.

I thought that this PR would resolve this issue tho? Otherwise, I create my own issue.
#7873 is the same problem.

#7589 (comment)

@OrKoN OrKoN force-pushed the fix_proxy_incognito_context branch from bfa5799 to f9b06de Compare March 3, 2022 13:24
@OrKoN OrKoN enabled auto-merge (squash) March 7, 2022 09:53
@OrKoN OrKoN force-pushed the fix_proxy_incognito_context branch from f9b06de to 3cc06e6 Compare March 7, 2022 09:53
@OrKoN OrKoN merged commit 3feca32 into puppeteer:main Mar 7, 2022
@jimmydief jimmydief deleted the fix_proxy_incognito_context branch March 7, 2022 18:33
This was referenced May 30, 2022
This was referenced May 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Puppeteer 10.4.0 ignores the proxy-server launch argument
5 participants