Reorder middlewares and rebalancer