Check in the implementation of the redirect middleware