jetty.project
jetty.project copied to clipboard
Jetty Proxy with “Fire and Forget”
Jetty version Latest 9
Java version 8
Question Hello, thank you very much for jetty-proxy module. It is very helpful. We have a use case where we want to proxy the request but don’t want to wait for the response. I tried a few things but was unable to achieve this and I was wondering if there is a mechanism in which we could achieve this even if we need to override a method.
To clarify further, the response to the client could be SC_ACCEPTED and in this case the client isn’t interested in the actual result of the proxied call.
The 202 Accepted
response is an odd one for a proxy.
Does this mean the proxy has to store the response for the later request to same resource from the same client? (yeah, that's not the role of a proxy)
Does that mean the proxy now has to track cookies of it's own, ones not related to the backend server? (nope, cannot do that in all circumstances)
Thank you very much for the reply. In this use case the proxy doesn’t need to store the response and the client will not inquire about it later. The proxy can just respond to the client with 202 Accepted and then proceed to proxy the request.
How would the proxy know what requests should be normally proxied, and which ones should be async processed with a 202 Accepted
response?
Thank you very much for the reply. We are currently migrating applications form one cloud provider to another. We had a need to capture and replay requests from the live instance of the application to the migrated instance to make sure that the migrated instance functions properly and can handle similar load.
We successfully implemented this using nginx’s mirror module (https://nginx.org/en/docs/http/ngx_http_mirror_module.html) where the request is proxied to the live instance of the application and is also mirrored to the migrated instance which is still being tested.
But unfortunately even though the response for the mirrored request is ignored by nginx, the response time of the mirrored request is added to the overall response time which is not desirable and that impacts live traffic.
So my goal was to reimplement this using jetty-proxy by having 2 servlets and make the mirror such that it doesn’t impact overall response time. The first servlet mapped to /* will get the request and will forward to the second servlet mapped to /mirror. The mirror servlet will proxy to migrated server and not wait for the response. The first servlet will proceed to proxy to live instance of the application and send a response to the client. This is what I had in mind and I was wondering if you had any guidance on how to achieve it.
If the 2 servlet solution is not possible, we could still maintain nginx but make the mirror be a local instance of jetty-proxy with a single servlet running in spring boot and that is also when we would like for the mirror request to be async processed to the migrated instance of the application and respond with 202 Accepted. We could create an init-parameter for configuration of async request for jetty-proxy to determine is the request should be async processed or not.
@joakime thank you very much again for looking into this issue. Did you by any chance see my last replies?
This issue has been automatically marked as stale because it has been a full year without activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically marked as stale because it has been a full year without activity. It will be closed if no further activity occurs. Thank you for your contributions.