Issue #1921224 by perohu, brantwynn: infinite loop removed when attempting to redirect users to the same environment