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

Support http proxies #10958

Closed
wants to merge 1 commit into from
Closed

Support http proxies #10958

wants to merge 1 commit into from

Conversation

msujew
Copy link
Member

@msujew msujew commented Mar 30, 2022

What it does

Closes #7797

Adds general proxy support to the whole application (backend+frontend) by using a RequestService which comes with automatic proxy support. Other services and downstream applications are encouraged to use that service whenever requests to non-origin or non-localhost web-services are performed.

Also patches the http and https node.js imports for the extension host. This enables extensions to perform requests through proxies as well.

For electron there's currently a large TODO: Automatic OS proxy detection doesn't work yet, since that requires access to the electron-main process (see also #10698).

How to test

Generally, testing this PR requires setting up firewall rules which block all outgoing traffic and configuring a local proxy rule. I used Fiddler Classic (Windows only?) which sets itself up at http://localhost:8888. I assume Mac and Linux users have a simpler time configuring such a proxy.

Also, these tests should preferably performed using the Electron version. The browser version will automatically use the OS proxy for stuff like fetching vsx search results, whereas the electron version will fail if the proxy is not configured.

  1. Open the vsx registry and search for java. Nothing should appear if outbound traffic is blocked.
  2. Search in the preferences for proxy and set the Http: Proxy preference to your local proxy url.
  3. Confirm that re-searching displays results (frontend request) and allows to install the extension (backend request).
  4. Install the proxy-test extension.
  5. Execute the Hello World Request command. It will send a request to https://www.google.com and display the error message/success code.
  6. Change the Http: Proxy support preference. override, fallback and on should all provide the same success result, while off should display an error, since the extension proxy support has been turned off.

There are now proxy settings for fetching packages from ovsx registries using the theia download:plugins command.

  1. Delete your plugins folder.
  2. Executing theia download:plugins should result in an error, since the outgoing download requests are blocked
  3. Adding the --proxy-url <url> parameter should enable successful download of these extensions.

Review checklist

Reminder for reviewers

dev-packages/cli/package.json Outdated Show resolved Hide resolved
@msujew msujew force-pushed the msujew/http-proxy branch 5 times, most recently from 6374722 to 68bb515 Compare March 30, 2022 19:00
Copy link
Contributor

@colin-grant-work colin-grant-work left a comment

Choose a reason for hiding this comment

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

Just a quick glance through the code so far. I'll take a closer look and test it after the release.

}

override async resolveProxy(url: string): Promise<string | undefined> {
// TODO: Implement IPC to the backend to access the Electron proxy resolver
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this be possible once #10698 (or something like it) is in place?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, that's what #10698 was initially meant for.

packages/plugin-ext/src/hosted/node/plugin-host-proxy.ts Outdated Show resolved Hide resolved
@msujew msujew force-pushed the msujew/http-proxy branch 2 times, most recently from 8db8e4b to 366d5ed Compare April 13, 2022 10:38
@msujew msujew closed this Apr 19, 2022
@msujew msujew mentioned this pull request Apr 19, 2022
1 task
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

Successfully merging this pull request may close these issues.

Theia Electron Application - Proxy settings
3 participants