Add support of middleware.