Add support for redirects with option to limit the number of redirections