Are you sure it’s not WordPress redirecting to the /?redirect_to endpoint? It’s unlikely that Discourse is doing that..
/?redirect_to