line / armeria

Your go-to microservice framework for any situation, from the creator of Netty et al. You can build any type of microservice leveraging your favorite technologies, including gRPC, Thrift, Kotlin, Retrofit, Reactive Streams, Spring Boot and Dropwizard.
https://armeria.dev
Apache License 2.0
4.73k stars 899 forks source link

How does one configure a PROXY to use for HTTP(S) clients? #2320

Closed slyphon closed 4 years ago

slyphon commented 4 years ago

I'm sorry if this is covered in the documentation already, I've spent about an hour looking through the source and docs and can't figure out how to do this. There are examples for how to make a service that acts as a proxy, but not how to configure a client to use a proxy (as far as I can tell).

I'm using a library that's in turn using armeria to talk to google cloud services using gRPC. At my company, we use an "egress proxy" in production. With curl we can use the http_proxy environment variable to set the proxy address and credentials. I'm trying to figure out how to do something similar (i.e. figure out where to configure this) if the library I'm using gives me the ability to supply com.linecorp.armeria.client.ClientFactory and com.linecorp.armeria.client.ClientOptions to its constructor.

I was expecting something on either ClientFactoryBuilder or in ClientOptionsBuilder that would let me specify the proxy to use when making connections. I see that there's proxy mentioned in the SessionProtocol enum, but I can't figure out how to combine these things together.

Any help would be appreciated.

Thanks!

minwoox commented 4 years ago

Thank you for trying with Armeria! I'm afraid to tell you that we don't support the proxy protocol on the client-side. We just made the server-side compatible with the proxy protocol.

I think it's not hard to implement it if we make it only work on HTTP protocol (not protocol-agnostic) but there was no demand for that. So we didn't implement it yet but we might work on this after we release 1.0. 😄

Using Forwarded and X-Forwarded-For headers are the only way to relay the address of the original client at the moment with Armeria. 😢

slyphon commented 4 years ago

OK! That may be why i couldn't find it! Now I don't feel so dumb :)

trustin commented 4 years ago

Created an issue for you - https://github.com/line/armeria/issues/2321

slyphon commented 4 years ago

Cheers!

trustin commented 4 years ago

Oh, and HI from an ex-tweep! Happy to see an interest from there. :heart:

slyphon commented 4 years ago

Glad to see you're doing great things! :D

On Thu, Dec 12, 2019 at 11:10 PM Trustin Lee notifications@github.com wrote:

On, and HI from an ex-tweep! Happy to see an interest from there. ❤️

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/line/armeria/issues/2320?email_source=notifications&email_token=AAALMRB4SDZ3HL24H7QIHULQYMDLZA5CNFSM4J2GHJS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGY24WY#issuecomment-565292635, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAALMRBJYO2OMCEMCWCYGL3QYMDLZANCNFSM4J2GHJSQ .

trustin commented 4 years ago

We have added support for SOCKS4/5 and HTTP CONNECT, but we don't have PROXY support yet. Created a dedicated issue for it since #2321 has been closed: https://github.com/line/armeria/issues/2589