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

HttpClient proxy configuration per request #2746

Open
jordillachmrf opened this issue Mar 27, 2023 · 6 comments
Open

HttpClient proxy configuration per request #2746

jordillachmrf opened this issue Mar 27, 2023 · 6 comments
Labels
help wanted We need contributions on this type/enhancement A general enhancement

Comments

@jordillachmrf
Copy link

As explained here https://stackoverflow.com/questions/74893474/is-there-any-way-to-imlement-a-rotating-proxy-based-httpclient-in-reactor-netty it would be nice if reactor-netty HttpClient could be configured in a per request basis, instead of being "statically" configured as explained in the docs https://projectreactor.io/docs/netty/1.1.5/reference/index.html#_proxy_support_2

Motivation

Some of our clients are GDRP constrained and based on the location of their servers and our servers(eeuu vs eu) we get 451 status codes(legal reasons)

Desired solution

HttpClient client = HttpClient.create() .proxy((spec, req) -> spec.type(ProxyProvider.Proxy.HTTP) .host("proxy") .port(8080) .nonProxyHosts("localhost") .connectTimeoutMillis(20_000));
req -> HttpClientRequest, if HttpClientRequest would be available then we could route the request to our eeuu proxy or eu proxy based on the destination uri.

Considered alternatives

Have various HttpClients's, handle 451 in our code and fallback to the appropriate HttpClient at runtime

@jordillachmrf jordillachmrf added status/need-triage A new issue that still need to be evaluated as a whole type/enhancement A general enhancement labels Mar 27, 2023
@pderop pderop self-assigned this Mar 28, 2023
@pderop pderop removed the status/need-triage A new issue that still need to be evaluated as a whole label Mar 28, 2023
@pderop
Copy link
Member

pderop commented Mar 28, 2023

I will take a look at this issue soon.

@violetagg violetagg assigned violetagg and unassigned pderop Apr 25, 2023
@violetagg
Copy link
Member

@jordillachmrf Can you elaborate more about the desired solution? You know the destination URI as this is something the the one that uses the HttpClient provides. Based on this you can then choose which HttpClient to use i.e. the one configured with proxy for x or the one configured with proxy for y.

@violetagg violetagg added the for/user-attention This issue needs user attention (feedback, rework, etc...) label Apr 28, 2023
@jordillachmrf
Copy link
Author

And that's exactly how we are tackling this, but keeping the routing solution close the proxy configuration seems to us more appropriate than moving this logic one layer above.
We have various "services" that use these various proxied webClients, we have had to wrap these into an artificial layer to hide this complexity.
We were wondering that adding this flexibility when configuring the proxy would allow us to get rid of this

@violetagg violetagg added this to the General Backlog milestone May 1, 2023
@violetagg
Copy link
Member

violetagg commented May 1, 2023

@jordillachmrf I'm gonna add this to the general backlog. For the time being please use the described solution in my previous comment.
The team will discuss when and how this can be implemented. If you can work on this feature and provide a PR, this will be great.

@violetagg violetagg added help wanted We need contributions on this and removed for/user-attention This issue needs user attention (feedback, rework, etc...) labels May 1, 2023
@violetagg violetagg removed their assignment May 1, 2023
@longkunbetter
Copy link
Contributor

@violetagg Is somebody working on this problem?

@violetagg
Copy link
Member

@longkunbetter We are not working on this one. I marked this with help wanted if somebody wants to work on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted We need contributions on this type/enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

4 participants