-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Hapi request events are not being triggered with basepath proxy #37403
Comments
Pinging @elastic/kibana-platform |
Just a note that after talking with @spalger this seems to be related to the base path proxy, as disabling it fixed the issue. |
It looks like the h2o2 plugin we use for the base path proxy does not expose the original request in any programmatic way, so we can't listen for connection aborts to abort the request to the proxied service. It looks like we'd need to fork and change that plugin in order to fix this. |
That said, this dependency is pretty small and we could probably just rip it out and replace it with what we need. |
@joshdover This isn't blocking me at all, I'm moving forward with development of my feature with the base path disabled. (I played around with nginx as a proxy instead and it seems to close the connections on the upstream connection just fine, as long as you have it configured correctly.) |
FYI: We're upgrading to hapi v18 in #80468, which includes an upgrade of |
Ran into this as well today (found a Slack conversation about it by accident). |
still reproduced on the master |
running into this as well. for context: Maps-backend needs to respond to request-cancellation so it can do some resource-cleanup. #90440 |
At this point, I think it's worth letting this bug stay open until we migrate to Bazel. Bazel will allow us to experiment with using a more realistic proxy, like nginx, which should better represent real-world scenarios. |
After more consideration and looking at what config we need to use in the proxy, I think it's likely better for us to go ahead and fix this upstream rather than waiting for Bazel to be ready for this. This appears to be a growing issue for developers and likely is fixable. One concern is that the |
Ok, so I took a quick look. It seems as easy as adding request.raw.req.once('aborted', function () {
promise.req.abort();
}) here: https://github.com/hapijs/h2o2/blob/2ac14fc746d21f97f4bb8004bc80b620d076c770/lib/index.js#L164 (and adding tests) Currently working on an upstream PR. Will see if there is any response or if we'll have to fork / copy to our repo. |
Created hapijs/h2o2#125, now waiting for upstream |
hapijs/h2o2#125 has been merged, and v9.1.0 released. Will open a PR soon to bump the version. |
I've set up a server route like so:
However, the
console.log
statements never occur, even when the request is actually disconnected. (See https://hapijs.com/api/17.5.3#-requestevents.)When I set up a brand new project with only Hapi/17.5.3 as the dependency and register the exact same route, then abort a request, I see the event is triggered.
The text was updated successfully, but these errors were encountered: