add redirection management in restful middleware