-
-
Notifications
You must be signed in to change notification settings - Fork 78
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
where to set HTTP_PROXY in python app? #13
Comments
Hi, HTTP_PROXY is an environment variable that the python gRPC should automatically read and use (see https://github.com/grpc/grpc/blob/master/doc/environment_variables.md). So you should be able to do something in a terminal like: # Terminal 1
python greeter_server.py
# Terminal 2
export HTTP_PROXY=localhost:<grpc_dump_port>
python greeter_client.py Could you see if this works? And thanks for the question! I'll update the docs to make it clear that HTTP_PROXY is an environment variable |
Ah, another thing that might be causing an issue: proxies are normally ignored for localhost connections. |
probably because my client is grpc web? so it can not read the http_proxy? |
Could you give me the You should be able to configure your browser to use |
Thanks for the instruction. I start to understand what is going on.
telling the proxy, my_app, want to talk to the server at $SERVER_PORT. proxy then talk to the server. the network flow in my situation is like this: web (grpc-web) --80--> envoy --9090-> grpc-server. if I put run I did not tell the grpc-web (or envoy more precisely) that it is a proxy. In order to make it work, have to find some way to config the envoy tell it about the proxy. then the whole network flow is like this: web (grpc-web) --80-- envoy---$DUMP_PORT--grpc-dump--9090-grpc-server If grpc-dump can have an in port and an out port. I could run something like |
Yup I think you've got the right idea.
I think grpc-dump --port=9090 --destination=localhost:9091 |
I tried the destination option and have difficulty to get it working. so tried the destination flag on the hello world: https://github.com/swuecho/hello_grpc when use but use destination flag seem have some problem. Is there a test case for this situation? |
Aha! Thanks for the repo link, I've found a bug with the Test coverage definitely isn't a strong point at the moment 🙁 |
Ok, so as of v0.1.2 you have two options:
Looking at the gRPC library code, you're right that python is a bit pickier than Go when it comes proxies so you have to use lower case Using grpc-dump v0.1.2 both of these cases are working on my machine with just the port changes in greeter_client.py described. |
Thanks. I verified the option 1 works for grpc-web workflow. This is important for grpc-web users, because grpc-web project usually use envoy proxy. I did not find an option to tell envoy proxy to use http_proxy. As a result, no control in the client side (even it has such an option, I do not want to play with the complex yaml config). |
Thanks for this library. really make grpc more easy to use.
I am trying the example with my python sever. have no idea what is the http_proxy for. If I let the grpc_dump connect to the port my python server listening to. The request are show, but no any response.
my python server is simliar to:
https://github.com/grpc/grpc/blob/master/examples/python/helloworld/greeter_server_with_reflection.py
clearly I miss something. I am trying to find the demo app you are using. Could you put the echo app code as an example? Thanks.
The text was updated successfully, but these errors were encountered: