@Override public HttpHandler createHttpHandler(Predicate predicate, final HttpHandler next) { // this is a bit of a hack at the moment. Basically we only want to create a single mod_cluster // instance // not matter how many filter refs use it, also mod_cluster at this point has no way // to specify the next handler. To get around this we invoke the mod_proxy handler // and then if it has not dispatched or handled the request then we know that we can // just pass it on to the next handler final HttpHandler mcmp = managementAccessPredicate != null ? Handlers.predicate(managementAccessPredicate, config.create(modCluster, next), next) : config.create(modCluster, next); final HttpHandler proxyHandler = modCluster.getProxyHandler(); HttpHandler theHandler = new HttpHandler() { @Override public void handleRequest(HttpServerExchange exchange) throws Exception { proxyHandler.handleRequest(exchange); if (!exchange.isDispatched() && !exchange.isComplete()) { exchange.setResponseCode(200); mcmp.handleRequest(exchange); } } }; UndertowLogger.ROOT_LOGGER.debug("HttpHandler for mod_cluster MCMP created."); if (predicate != null) { return new PredicateHandler(predicate, theHandler, next); } else { return theHandler; } }