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

Extension proxy support #12588

Open
CodeZombieCH opened this Issue Sep 25, 2016 · 28 comments

Comments

Projects
None yet
@CodeZombieCH
Copy link

CodeZombieCH commented Sep 25, 2016

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 vscode API 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.

@jrieken

This comment has been minimized.

Copy link
Member

jrieken commented Sep 28, 2016

-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?

@jrieken jrieken removed the api label Sep 28, 2016

@joaomoreno

This comment has been minimized.

Copy link
Member

joaomoreno commented Sep 28, 2016

It's thin.

@jrieken jrieken removed their assignment Sep 28, 2016

@jrieken jrieken changed the title Expose an API for extensions to use a proxy Make proxy code reusable Sep 28, 2016

@jrieken

This comment has been minimized.

Copy link
Member

jrieken commented Sep 28, 2016

I leaving it with you then ;-)

@joaomoreno joaomoreno added this to the Backlog milestone Sep 28, 2016

@CodeZombieCH

This comment has been minimized.

Copy link
Author

CodeZombieCH commented Sep 28, 2016

A node package sounds like a cool solution. Let me know when it's ready so I can test it and provide feedback.

@joaomoreno

This comment has been minimized.

Copy link
Member

joaomoreno commented Apr 26, 2017

We're going with a different proxy solution in the future, skipping this.

@joaomoreno joaomoreno closed this Apr 26, 2017

@CodeZombieCH

This comment has been minimized.

Copy link
Author

CodeZombieCH commented Apr 26, 2017

Do you have any details about that future solution?

@joaomoreno

This comment has been minimized.

Copy link
Member

joaomoreno commented Apr 26, 2017

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 joaomoreno reopened this Apr 26, 2017

@joaomoreno joaomoreno changed the title Make proxy code reusable Expose network service to extensions Apr 26, 2017

@joaomoreno joaomoreno removed their assignment Jun 19, 2017

@joaomoreno joaomoreno changed the title Expose network service to extensions Extension proxy support Jul 3, 2017

@tebeco

This comment has been minimized.

Copy link

tebeco commented Dec 4, 2017

@joaomoreno any news from April ?
times to times, We have to set our password in clear so far in the settings json file in order to update OmniSharp

This is insane and quite critical
Everybody tries to point someone else team and it really hurt lots of people using VsCode in companies

@tebeco

This comment has been minimized.

Copy link

tebeco commented Dec 4, 2017

Do i need to ping more contributor to VsCode in order to get more feedback on it ?

@kaufmd

This comment has been minimized.

Copy link

kaufmd commented Sep 4, 2018

I am running the latest VS Code version on macOS Sierra and I'm seeing a ECONNREFUSED when trying to fetch from "https://schemastore.azurewebsites.net/schemas/json/tsconfig.json" whenever I open my tsconfig.json even though the proxy settings are definitely correct. When I call the failing address in a Chrome instance it opens perfectly fine.
I was testing using all the methods there are:

  • starting VS Code with parameters
  • setting the http.proxy, etc. settings within VS Code
  • setting environment variables HTTP_PROXY and HTTPS_PROXY

My findings:

  1. on macOS the parameters at startup are having absolutely no effect on the behavior. VS Code cannot even resolve the URL.

  2. Setting http.proxy inside of VS Code or using the env variables has the same effect (even though I didn't test what takes precedence in the end)

  3. The ECONNREFUSED seems to come from our company proxy server. I could rule out that it is a authentication problem by specifying my credentials
    It came from our internal proxy server indeed due to the fact that I provided the AD domain in front of the user which lead to an instant bounce instead of going through the configured rules. Leaving out the AD domain I got 407's smacked in my face. After hours of debugging the issue with a guy from the proxy department we finally found out that there's something off within the proxy settings. The fallback from (C)NTLM to Basic Auth did only work if the client supported this. Now the config is changed in a way that if the client asks for Basic Auth the proxy won't first try to use NTLM anyway but right away Basic Auth.
    Nevertheless: specifying credentials in plain text and disabling SSL verification is a more than ugly way to work around this problem (which can't be a permanent solution anyway as pointed out by @tebeco)

Considering that these issues have been going on for almost 2 years now (look at the ticket creation date!) it is definitely about time to solve them for good. @joaomoreno considering that this also happens with the TypeScript extension is very sad to see. Microsoft should have an eager interest in supporting corporate environments. The lack of updates and support from the VS Code team in this ticket - sorry to say - though unfortunately shows the opposite.

@joshsackos

This comment has been minimized.

Copy link

joshsackos commented Dec 5, 2018

Cannot install Particle Workbench dependencies behind a proxy at work. This is an old ticket, if Microsoft actually wants people to use VS Code, then they should fix this. Companies should really look at an alternative to VS Code due to this limitation. All corporate users behind a proxy will not be able to use the company's VS Code extensions that need to download external content, thus rendering the company's efforts useless, and then the customer will probably find an alternative product that provides decent tools, which will reduce the company's profits. Have a merry Christmas everyone! :)

@gsemet

This comment has been minimized.

Copy link

gsemet commented Dec 5, 2018

If you define HTTP_PROXY and HTTPS_PROXY, extension can « see » the outer world. It I sad to see this support is not straight but as least it does the job. And you may have to hardcore your proxy password in an env car, which is pretty bad...

@joshsackos

This comment has been minimized.

Copy link

joshsackos commented Dec 5, 2018

No, setting HTTP_PROXY and HTTPS_PROXY does not solve the issue.

@gsemet

This comment has been minimized.

Copy link

gsemet commented Dec 5, 2018

I do have them, with lowercase as well, in my use env var, and it works

@joshsackos

This comment has been minimized.

Copy link

joshsackos commented Dec 5, 2018

Windows environment variables are not case sensitive, so you can only have one variable for each. Glad that you have a solution that works for you. Obviously it is not a universal solution though. Best of luck to you, happy holidays!

@joaomoreno

This comment has been minimized.

Copy link
Member

joaomoreno commented Dec 6, 2018

Hey guys you might wanna follow #60773

There's been some great exploration development by @chrmarti: #64202

@nschonni

This comment has been minimized.

Copy link
Contributor

nschonni commented Feb 8, 2019

It looks like this was included with 1.31.
It doesn't support NO_PROXY, but I'm opening a separate issue for that

@SetTrend

This comment has been minimized.

Copy link

SetTrend commented Mar 13, 2019

@m451: I suggest to utilize the system default proxy, too.

The organization I'm currently working for is using NTLM authentication with their proxy. This is causing HTTP 407 errors when using environment variables HTTP_PROXY/HTTPS_PROXY.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.