Github user EronWright commented on a diff in the pull request: https://github.com/apache/flink/pull/4767#discussion_r142696121 --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/AbstractRestHandler.java --- @@ -157,7 +160,12 @@ protected void respondAsLeader(final ChannelHandlerContext ctx, Routed routed, T HandlerUtils.sendErrorResponse(ctx, httpRequest, new ErrorResponseBody("Internal server error."), HttpResponseStatus.INTERNAL_SERVER_ERROR); } } else { - HandlerUtils.sendResponse(ctx, httpRequest, resp, messageHeaders.getResponseStatusCode()); + if (resp instanceof WebSocketUpgradeResponseBody) { + upgradeToWebSocket(ctx, routed, (WebSocketUpgradeResponseBody) resp); --- End diff -- The REST handler is not active after the upgrade is complete, and it would be harmless to remove from the pipeline. The message handler takes over, reading and writing websocket frames based on typed messages.
---