Skip to content

fix: use proxy only for remote requests #4565

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

Merged
merged 1 commit into from
Apr 30, 2019

Conversation

martinfrancois
Copy link
Contributor

@martinfrancois martinfrancois commented Apr 24, 2019

PR Checklist

Since there are no tests for http-client yet, it would be quite a lot of work to add them. Also, the method which was changed useProxySettings is private and therefore more difficult to test.

What is the current behavior?

With a proxy set according to https://docs.nativescript.org/tooling/docs-cli/general/proxy-set when running unit tests with tns test android for example, requests to localhost are being made. Depending on the corporate proxy environment, those requests could be blocked or the proxy can't handle the request, since localhost is not a remote target. This makes running unit tests with NativeScript impossible in corporate proxy environments, causing exceptions interrupting the test execution. Also, it doesn't make sense to make requests to localhost through a proxy, so this will not have any negative effects.

What is the new behavior?

When requests are being made to localhost or 127.0.0.1, even when a proxy is set, the proxy will not be used. Unit tests can be excecuted successfully in an environment with a corporate proxy.

Partially fixes #2313.
A user-defined NO_PROXY is not implemented, but allows for requests to localhost to work properly. Should there be further need to customize which requests should not use the proxy, this could be implemented in a separate PR, but would require discussion on the implementation details.

Do not use the proxy for requests to localhost or 127.0.0.1 when NativeScript is configured to use the proxy.

Partially fixes issue NativeScript#2313, since requests to localhost will be possible in corporate proxy environments.
@cla-bot cla-bot bot added the cla: yes label Apr 24, 2019
@ghost ghost added the new PR label Apr 24, 2019
@Fatme
Copy link
Contributor

Fatme commented Apr 30, 2019

test cli-smoke

@Fatme Fatme merged commit a28b41b into NativeScript:master Apr 30, 2019
@ghost ghost removed the new PR label Apr 30, 2019
@Fatme
Copy link
Contributor

Fatme commented Apr 30, 2019

@martinfrancois,

Thank you for this PR!

If this is your first contribution to NativeScript, you are eligible for our NativeScript First-Time Contribution program. More info can be found here.

@martinfrancois
Copy link
Contributor Author

@Fatme,

You're welcome! Thanks for merging it!

It's indeed my first contribution to NativeScript. Thanks for letting me know!

@martinfrancois martinfrancois deleted the fixProxyLocalRequests branch April 30, 2019 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

no_proxy support
2 participants