Tool for conditionally executing middleware.