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

Added http.noProxy setting which is same as NO_PROXY env variable value that is already present currently #211958

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

mohankumarelec
Copy link

Testing Process

To test the http.noProxy setting in Visual Studio Code, you can follow these steps:

  1. Open Visual Studio Code: Launch Visual Studio Code on your computer.

  2. Access Settings: Navigate to the settings panel by clicking on "File" > "Preferences" > "Settings" or by using the shortcut Ctrl + , (Cmd + , on macOS).

  3. Search for http.noProxy Setting: In the search bar at the top of the settings panel, type http.noProxy. This will filter the settings to display only the http.noProxy setting.

  4. Modify http.noProxy Setting (if necessary): If you haven't already set the http.noProxy value, you can add it by clicking on the "Edit in settings.json" link below the setting. Alternatively, you can directly modify the settings.json file. Set the value of http.noProxy to a comma-separated list of domains or IP addresses that you want to exclude from the HTTP proxy routing. For example:

    "http.noProxy": "localhost, 127.0.0.1, example.com"
  5. Save Settings: After making changes, save the settings.json file.

  6. Test Connectivity: Now, you can test the changes by attempting to access resources that match the exclusions defined in http.noProxy. For example, if you've excluded localhost from the proxy routing, try accessing a local server running on your machine.

  7. Observe Network Requests: You can also use network debugging tools within Visual Studio Code or external tools like browser developer tools to observe network requests and confirm that the excluded domains or IP addresses are not being routed through the HTTP proxy.

  8. Verify Results: Verify that the excluded resources are accessible without going through the proxy server, confirming that the http.noProxy setting is functioning as expected.

By following these steps, you can effectively test the http.noProxy setting in Visual Studio Code and ensure that it meets your network configuration requirements.

@mohankumarelec
Copy link
Author

@microsoft-github-policy-service agree

Copy link
Contributor

@chrmarti chrmarti left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Left a comment.

src/vs/platform/request/common/request.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@chrmarti chrmarti left a comment

Choose a reason for hiding this comment

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

Thanks for the update. To make it work for extensions (it currently only reconfigures Electron), you also need to loop the value in to: https://github.com/microsoft/vscode-proxy-agent/blob/91b81109c75632b18fa2340f296ccaff9e9bcefa/src/index.ts#L80

src/vs/platform/request/common/request.ts Outdated Show resolved Hide resolved
src/vs/platform/windows/electron-main/windowImpl.ts Outdated Show resolved Hide resolved
src/vs/platform/windows/electron-main/windowImpl.ts Outdated Show resolved Hide resolved
@mohankumarelec
Copy link
Author

Thanks for the update. To make it work for extensions (it currently only reconfigures Electron), you also need to loop the value in to: https://github.com/microsoft/vscode-proxy-agent/blob/91b81109c75632b18fa2340f296ccaff9e9bcefa/src/index.ts#L80

Hi @chrmarti ,
I have updated the code to set no_proxy variable value to process.env from configuration, so that the no_proxy env variable gets directly passed to the @vscode/proxy-agent via ProxyAgentParams and the no_proxy support is enabled for extensions too.

https://github.com/microsoft/vscode-proxy-agent/blob/91b81109c75632b18fa2340f296ccaff9e9bcefa/src/index.ts#L73-L80

@@ -966,6 +966,7 @@ export class CodeWindow extends BaseWindow implements ICodeWindow {
newHttpProxy = newHttpProxy.substr(0, newHttpProxy.length - 1);
}

process.env['no_proxy'] = process.env['no_proxy'] || (this.configurationService.getValue<string[]>('http.noProxy') || ['']).map((item) => item.trim()).join(',')
Copy link
Contributor

Choose a reason for hiding this comment

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

This is slightly inconsistent with how we handle the http.proxy setting. I suggest to leave the env variable as-is and pass the http.noProxy setting in proxyResolver.ts the same way the other settings are already passed.

Copy link

@Brianm93 Brianm93 left a comment

Choose a reason for hiding this comment

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

H

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.

None yet

3 participants