Support two different middleware signature