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
Extension proxy support #12588
Comments
|
-1 for adding this for to the API but +1 for extracting our code into a node-module. @joaomoreno how feasible is that? how much code do we add on top of other node-modules? |
|
It's thin. |
|
I leaving it with you then ;-) |
|
A node package sounds like a cool solution. Let me know when it's ready so I can test it and provide feedback. |
|
We're going with a different proxy solution in the future, skipping this. |
|
Do you have any details about that future solution? |
|
Actually, I might've closed this too eagerly. We're going with using Chrome's network stack for everything. So you're a bit busted. The only way out is exposing an API for making network requests. I'll leave this open for that. |
|
@joaomoreno any news from April ? This is insane and quite critical |
|
Do i need to ping more contributor to VsCode in order to get more feedback on it ? |
|
I had a progress with this which I believe may be related: after launching "code --verbose" I could see errors like the following:
I then followed the instructions at Linux Cert Management in order to add our corporate CA certificate as follows:
After relaunching VSCode everything seems working! |
|
For those visiting this from a search engine, to make extensions like C# work via an https proxy with authentication, right now you need the following:
I tested this both in 1.46.1 and 1.48.0 (with auth.js fix) |
|
This look like it would be more sustainable to have all of this baked within VsCode, and not at the full charge of extensions developer, and at the cost of consumer security. Somehow, having an API in VsCode return an HttpClient already setup, and supporting POSSIBLE The equivalent in C# would look like: public HttpClient GetMeSomethingReady()
{
var proxyHttpClientHandler = new HttpClientHandler()
{
Proxy = new WebProxy("http://FROM_THE_SETTING_NO_CREDENTIALS")
{
Credentials = CredentialCache.DefaultNetworkCredentials
},
SslProtocols = SslProtocols.Tls13 | SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls,
UseProxy = true
};
return new HttpClient(proxyHttpClientHandler);then extensions developers would do something like var httpClient = GetMeSomethingReady();
httpClient.Get(url)If they want to do everything from scratch ... why not, but it look like this should be
|
|
@orthoxerox Part of win-ca is already built-in, you shouldn't need to install it separately. |
|
@chrmarti I shouldn't, but I had to. |
|
Here is a workaround that enables extensions to be used in a devcontainer while a mitm solution (such as zscaler) is deployed to your network. In "remoteEnv": {
"NODE_EXTRA_CA_CERTS": "<PROVIDE_YOUR_TRUSTED_ROOT_CA_CERT_HERE>.crt"
},
"postCreateCommand": "sed -i -e 's/this\\.strictSSL=/this\\.strictSSL=false\\&\\&/g' $(find ~ -name *HostAgent.js)",I think root cause is that remoteExtensionHostAgent.js ignores all the existing settings.json files and overrides local container's npm/node configuration by default. Another way to achieve this is to configure |
|
Workaround for vscode.github-authentication giving a HTTP error 407 when receiving the authentication token from a browser: In VSCode Settings, you can set |
|
In VSCode Settings, you can set http.proxy to http://username:PASSWORD@your-proxy-ip:port |
|
Extension proxy support #12588 |
|
One alternative to the suggestion of creating a VSCode fetch API for extensions would be to use the VSCode host as a proxy. VS Code already supports PAC files and NTLM/GSS corporate proxy authentication. Using this networking stack it could expose a port to the extensions like CNTLM. This could be exposed in the form of http_proxy env variables (so no change would be required there). Network requests would then pass through VS Code. This feels like the simplest approach as it requires no change to extensions (continue to use http_proxy), the code for port forwarding is already in present. |


Proxy support for Visual Studio Code has been introduced recently through environment variables/settings (see https://code.visualstudio.com/docs/setup/setup-overview#_proxy-server-support). As an extension developer I would like to use these settings when requesting resources from the internet. My current implementation fails for users using a proxy.
What is the recommended way for an extension to use a proxy?
I could not find a
vscodeAPI that exposes methods to make requests using a proxy other than access to the proxy settings (workspace.getConfiguration()) and implementing everything on my own. Looking at the Visual Studio Code code base I identified the code that adds support for proxies, but copy&paste it into my extension would result in duplicated and potentially outdated code, which is something I want to avoid whenever possible. As I am probably not the only extension developer accessing the internet, I would like to hear your opinion on this issue. Any feedback would be greatly appreciated.The text was updated successfully, but these errors were encountered: