Fix infinite redirect loop