private void writeInternal(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
        if (!ctx.channel().isActive()) {
            ReferenceCountUtil.release(msg);
            return;
        }

        if (msg instanceof HttpRequestMessage) {
            promise.addListener((future) -> {
                if (!future.isSuccess()) {
                    Throwable cause = ctx.channel()
                            .attr(SSL_HANDSHAKE_UNSUCCESS_FROM_ORIGIN_THROWABLE)
                            .get();
                    if (cause != null) {
                        // Set the specific SSL handshake error if the handlers have already caught them
                        ctx.channel()
                                .attr(SSL_HANDSHAKE_UNSUCCESS_FROM_ORIGIN_THROWABLE)
                                .set(null);
                        fireWriteError("request headers", cause, ctx);
                        logger.debug(
                                "SSLException is overridden by SSLHandshakeException caught in handler level. Original"
                                        + " SSL exception message: ",
                                future.cause());
                    } else {
                        fireWriteError("request headers", future.cause(), ctx);
                    }
                }
            });

            HttpRequestMessage zuulReq = (HttpRequestMessage) msg;
            preWriteHook(ctx, zuulReq);

            super.write(ctx, buildOriginHttpRequest(zuulReq), promise);
        } else if (msg instanceof HttpContent) {
            promise.addListener((future) -> {
                if (!future.isSuccess()) {
                    fireWriteError("request content chunk", future.cause(), ctx);
                }
            });
            super.write(ctx, msg, promise);
        } else {
            // should never happen
            ReferenceCountUtil.release(msg);
            throw new ZuulException("Received invalid message from client", true);
        }
    }
Override to add custom modifications to the request before it goes out

@param headers
zuul-core/src/main/java/com/netflix/zuul/netty/server/OriginResponseReceiver.java