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

Avoid proxy issues for localhost only communication #377

Merged
merged 11 commits into from
Sep 12, 2024

Conversation

jasonmreding
Copy link
Collaborator

@jasonmreding jasonmreding commented Aug 26, 2024

Description

This PR attempts to avoid grpc connection issues due to http proxies when communicating over loopback addresses. If we detect the target address for a gRPC channel is the localhost or equivalent, then we explicitly disable sending traffic through the proxy.

Implementation

  • Added a git submuodule for asio which is what boost is based on. I attempted to use boost directly, but I couldn't figure out how to get headers only build to work in a reasonable way so I fell back to this solution which I found to be simpler.
  • Updated cmake files to add new include directories for the headers which are being used from asio
  • Updated LabVIEWgRPCClient::Connect to set GRPC_ARG_ENABLE_HTTP_PROXY to false if the target address is detected to be a loopback address.

Testing

I didn't see much in the way of an automated regression test framework so I didn't create any automated tests as part of this change. I manually tested that the following addresses worked and used the expected proxy settings:

src/grpc_client.cc Show resolved Hide resolved
src/grpc_client.cc Outdated Show resolved Hide resolved
src/grpc_client.cc Outdated Show resolved Hide resolved
@j-medland
Copy link

j-medland commented Aug 28, 2024

Could the user just specify a local env variable to specify if the proxy should be ignored for localhost etc?

https://github.com/grpc/grpc/blob/591d56e1300b6d11948e1b821efac785a295989c/doc/environment_variables.md

@jasonmreding
Copy link
Collaborator Author

Could the user just specify a local env variable to specify if the proxy should be ignored for localhost etc?

https://github.com/grpc/grpc/blob/591d56e1300b6d11948e1b821efac785a295989c/doc/environment_variables.md

Yes, that is an option and is what we have been telling customers to avoid these issues. However, the errors you get when this is a problem aren't very helpful, and a lot of time is wasted via support channels before getting to the bottom of what is wrong.

@jasonmreding
Copy link
Collaborator Author

@yash-ni @ni-sujain It looks like you have the most recently submitted PRs to the repo. Can you help me find someone to review this PR and/or give me write access to the repo so I can see who approving reviewers are?

@ni-sujain
Copy link
Collaborator

@yash-ni @ni-sujain It looks like you have the most recently submitted PRs to the repo. Can you help me find someone to review this PR and/or give me write access to the repo so I can see who approving reviewers are?

I have given you access. Thanks

@jasonmreding jasonmreding merged commit 2615738 into ni:master Sep 12, 2024
5 checks passed
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.

5 participants