Closed tsegismont closed 2 months ago
Thanks @pmlopes for the feedback! I have a couple of comments:
1/ I think ProxyHandler
should extend ProtocolUpgradeHandler
rather than PlatformHandler
because the user might want to add a security handler before.
2/ Perhaps we should keep both mechanisms because a handler having a priority lower than BODY
is not protected in the case of the following setup:
router.post().handler(BodyHandler.create());
router.route("/product").handler(ProxyHandler.create(productServiceProxy));
Or am I missing something?
@tsegismont yeap, that's correct, platform wouldn't allow anything before (other than another platform) protocol upgrade is a better suited interface. The unspoken contract is that if the handler performs any async call and doesn't terminate the request, it should pause/resume the request to ensure that once a body handler is on the route the body isn't lost like here:
and
I guess we should have these “bespoken” rules in the interface javadoc too 😅
You can also add another interface to cleary mark proxy related stuff if protocol upgrade
seems odd. There is no cost as the check only happens once in the lifecycle of the router, in the weight() function.
You can also add another interface to cleary mark proxy related stuff if
protocol upgrade
seems odd. There is no cost as the check only happens once in the lifecycle of the router, in the weight() function.
Protocol upgrade
is fine with me, the proxy can do this anyway (websocket proxy).
@pmlopes PTAL
See #2614
Added documentation and make ProxyHandler fail fast if the BodyHandler has been seen.