server: reorg middlewares