Add discover_app function in multiple app middleware.