Skip to content

Conversation

tsegismont
Copy link
Contributor

@tsegismont tsegismont commented May 7, 2025

Closes #35, closes #44

OriginRequestProvider is a Vert.x API type that unifies all the origin selection methods currently present as overloaded methods in HttpProxy.

OriginRequestProvider being a @FunctionalInterface, users can provide one in the form of a lambda.

OriginRequestProvider is a little different from the existing contract.
Instead of the proxied request and HTTP client as parameters, it has the ProxyContext (that exposes all the proxy data and the client).

This allows implementations to make a decision on the modifications interceptors can make (including when the request is an upgrade to WebSocket). See #44

It also allows interceptors and providers to exchange data via the ProxyContext attachments. See #35

@tsegismont tsegismont requested a review from vietj May 7, 2025 13:58
@tsegismont tsegismont added this to the 5.0.0 milestone May 7, 2025
@vietj
Copy link
Member

vietj commented May 7, 2025

this seems like a breaking change

@tsegismont
Copy link
Contributor Author

If there's a breaking change, it's not intentional, where is it?

@tsegismont
Copy link
Contributor Author

@vietj if you're referring to the new method HttpProxy#origin(OriginRequestProvier) then yes, any existing implementation would have to implement this new method.

But that won't break user applications, afaik

@vietj
Copy link
Member

vietj commented May 7, 2025

my point is that I am annoyed to do a vertx 5 release with deprecations from day 1 :-)

@tsegismont
Copy link
Contributor Author

tsegismont commented May 7, 2025

Ha, then I can remove the methods altogether and deprecate them in Vert.x 4

@vietj
Copy link
Member

vietj commented May 8, 2025

I also feel something is not right with the fact that the method takes an http client a argument which seem specific and might require more breaking change in the future

@tsegismont
Copy link
Contributor Author

tsegismont commented May 9, 2025

I also feel something is not right with the fact that the method takes an http client a argument which seem specific and might require more breaking change in the future

The current Proxy#originRequestProvider method does the same thing, and the reason is you need an HttpClient to provide the client request to the origin server.

@vietj
Copy link
Member

vietj commented May 9, 2025 via email

@tsegismont
Copy link
Contributor Author

Why? It gives users the opportunity to configure http client request stuff (e.g. RequestOptions)

@tsegismont tsegismont force-pushed the origin-request-provider branch from 4d828b8 to 4dc78e7 Compare May 9, 2025 10:32
Closes eclipse-vertx#35, closes eclipse-vertx#44

OriginRequestProvider is a Vert.x API type that unifies all the origin selection methods currently present as overloaded methods in HttpProxy.

OriginRequestProvider being a FunctionalInterface, users can provide one in the form of a lambda.

OriginRequestProvider is a little different from the existing contract.
Instead of the proxied request and HTTP client as parameters, it has the ProxyContext (that exposes all the proxy data and the client).

This allows implementations to make a decision on the modifications interceptors can make (including when the request is an upgrade to WebSocket). See eclipse-vertx#44

It also allows interceptor and provider to exchange data via the ProxyContext attachments. See eclipse-vertx#35

Signed-off-by: Thomas Segismont <[email protected]>
@tsegismont tsegismont force-pushed the origin-request-provider branch from 4dc78e7 to 63cb4fd Compare May 9, 2025 10:37
@tsegismont
Copy link
Contributor Author

@vietj I changed the content and updated the description accordingly. PTAL

@vietj vietj merged commit c41506d into eclipse-vertx:main May 11, 2025
5 checks passed
@tsegismont tsegismont deleted the origin-request-provider branch May 12, 2025 16:27
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.

originRequestProvider should be able to access ProxyContext to perform routing based on modified request Variable from interceptor to originSelector

2 participants