Allow the use of a Proc to decide if the middleware is enabled