middle_ware handle