Skip to content

no_proxy is not working on code-server #6811

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

Closed
2 tasks done
lionelhe opened this issue May 23, 2024 · 10 comments
Closed
2 tasks done

no_proxy is not working on code-server #6811

lionelhe opened this issue May 23, 2024 · 10 comments
Labels
bug Something isn't working upstream:vscode Needs to be fixed upstream in VSCode

Comments

@lionelhe
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

OS/Web Information

  • Web Browser: Chrome
  • Local OS: macOS or Windows
  • Remote OS: ubi8
  • Remote Architecture: amd64
  • code-server --version: 4.89.1

Steps to Reproduce

  1. Install Code-marketplace on your kubernetes cluster
  2. Create a code-server with env variable to access this code-marketplace inside the cluster (using svc.cluster.local)
    EXTENSIONS_GALLERY={"serviceUrl":"http://code-marketplace.code-marketplace.svc.cluster.local/api", "itemUrl":"http://code-marketplace.code-marketplace.svc.cluster.local/item", "resourceUrlTemplate": "http://code-marketplace.code-marketplace.svc.cluster.local/files/{publisher}/{name}/{version}/{path}"}
  3. Also add variable environment for corporate proxy + put cluster.local as no_proxy
    http_proxy="http://corporate-proxy.com"
    https_proxy="$http_proxy"
    no_proxy=".cluster.local,.cluster.local."
  4. Open Code-server
  5. Go in extensions tab to install extension

Expected

We should be able to see all plugins proposed in our cluster code-marketplace and install them

Actual

We get error:
Error while fetching extensions.
Proxy connection ended before receiving CONNECT response.

Logs

No response

Screenshot/Video

No response

Does this bug reproduce in native VS Code?

I did not test native VS Code

Does this bug reproduce in GitHub Codespaces?

I did not test GitHub Codespaces

Are you accessing code-server over a secure context?

  • I am using a secure context.

Notes

It seems to go through proxy even with no_proxy env variable set.

Without http_proxy set, it correctly connect to code-marketplace.

It seems to be coherent with the last status on coder/vscode #4672 (comment)

@lionelhe lionelhe added bug Something isn't working triage This issue needs to be triaged by a maintainer labels May 23, 2024
@code-asher
Copy link
Member

Is it failing to install the extensions or is it failing to list them at all? The listing request is sent from the browser, while the install happens from the backend, so I wonder if that has something to do with it.

@lionelhe
Copy link
Author

It is failing to get the extension list.
Not sure it is requesting from browser though because without the proxy, I can list them even while I do not have access to svc.cluster.local from my browser.

I guess more than proxy-agent used by coder/vscode does not succeed to use no_proxy env variable.

Maybe use of last version of proxy-agent Can correct that.
I also see that Microsoft vscode did have to do some change to make it work microsoft/vscode#147981 (comment)

@code-asher
Copy link
Member

code-asher commented May 28, 2024

The list query is supposed to run from the browser. If your browser does not have access to svc.cluster.local that would explain the error.

@code-asher
Copy link
Member

Er wait, maybe I misread. You said you can list them without the proxy? I am not entirely sure what is going on then. Maybe check the network tab in the browser dev tools and check to see if the requests are failing.

@code-asher
Copy link
Member

That no_proxy fix does seem promising though.

@lionelhe
Copy link
Author

Er wait, maybe I misread. You said you can list them without the proxy? I am not entirely sure what is going on then. Maybe check the network tab in the browser dev tools and check to see if the requests are failing.

Yes I "can" without the proxy
By testing with the dev tool, I sure have some error of extension listing on network but it is like it somehow use server-side request if it cannot find extensions from browser requests...

That no_proxy fix does seem promising though.
It does, it has not been merged on vscode but it seems to have been accepted on che-code che-incubator/che-code#234

@code-asher
Copy link
Member

Interesting, yeah searching extensions happens purely from the browser, so the server should not be involved. You should see a POST request to https://open-vsx.org/vscode/gallery/extensionquery, if that errors then no extensions will be shown.

@lionelhe
Copy link
Author

Ok so on my case I use a code-marketplace in my kubernetes cluster on which I have my code-servers.

I tried to use direct local connection (using svc.cluster.local) but it did not work for browser side obviously...

I played a little with the EXTENSIONS_GALLERY environment variable and added an ingress to be able to get access to my store from my browser.

It seems that putting serviceUrl on my ingress permits me to correctly get the list of my extensions from my browser.
It does not correct the no_proxy issue though, when it tries to get the package on server-side, it has an error of proxy (my enterprise proxy cannot access the ingress either...) whereas it should go through no_proxy.

I get error:
2024-05-31 13:49:24.162 [error] Error: Proxy connection ended before receiving CONNECT response
at Socket.onend (/usr/lib/code-server/lib/vscode/node_modules/https-proxy-agent/dist/parse-proxy-response.js:32:20)
at Socket.emit (node:events:529:35)
at endReadableNT (node:internal/streams/readable:1368:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

@code-asher
Copy link
Member

Glad the browser side is working now! But yeah sounds like we need that no_proxy fix for the server side to work.

@code-asher
Copy link
Member

Closing for now since it seems like the fix needs to be done upstream.

@code-asher code-asher closed this as not planned Won't fix, can't repro, duplicate, stale Jul 12, 2024
@code-asher code-asher added upstream:vscode Needs to be fixed upstream in VSCode and removed triage This issue needs to be triaged by a maintainer labels Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working upstream:vscode Needs to be fixed upstream in VSCode
Projects
None yet
Development

No branches or pull requests

2 participants