Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What it does
Closes #7797
Adds general proxy support to the whole application (backend+frontend) by using a
RequestServicewhich 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
httpandhttpsnode.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.
java. Nothing should appear if outbound traffic is blocked.proxyand set theHttp: Proxypreference to your local proxy url.proxy-testextension.Hello World Requestcommand. It will send a request tohttps://www.google.comand display the error message/success code.Http: Proxy supportpreference.override,fallbackandonshould all provide the same success result, whileoffshould 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:pluginscommand.pluginsfolder.theia download:pluginsshould result in an error, since the outgoing download requests are blocked--proxy-url <url>parameter should enable successful download of these extensions.Review checklist
Reminder for reviewers