diff --git a/gateleen-routing/src/main/java/org/swisspush/gateleen/routing/Forwarder.java b/gateleen-routing/src/main/java/org/swisspush/gateleen/routing/Forwarder.java index 92f062d7..e9ceccff 100755 --- a/gateleen-routing/src/main/java/org/swisspush/gateleen/routing/Forwarder.java +++ b/gateleen-routing/src/main/java/org/swisspush/gateleen/routing/Forwarder.java @@ -313,6 +313,7 @@ public void handle(AsyncResult event) { } HttpClientRequest cReq = event.result(); final Handler> cResHandler = getAsyncHttpClientResponseHandler(req, targetUri, log, profileHeaderMap, loggingHandler, finalStartTime, finalTimerSample, afterHandler); + cReq.response(cResHandler); if (timeout != null) { cReq.idleTimeout(Long.parseLong(timeout)); @@ -443,16 +444,16 @@ public WriteStream drainHandler(@Nullable Handler handler) { // Setting the endHandler would then lead to an Exception // see also https://github.com/eclipse-vertx/vert.x/issues/2763 // so we now check if the request already is ended before installing an endHandler - cReq.send(cResHandler); + cReq.send(); } else { - req.endHandler(v -> cReq.send(cResHandler)); + req.endHandler(v -> cReq.send()); pump.start(); } } else { loggingHandler.appendRequestPayload(bodyData); // we already have the body complete in-memory - so we can use Content-Length header and avoid chunked transfer cReq.putHeader(HttpHeaders.CONTENT_LENGTH, Integer.toString(bodyData.length())); - cReq.send(bodyData, cResHandler); + cReq.send(bodyData); } loggingHandler.request(cReq.headers());