In this talk we address the following question: is a sub-Riemannian metric uniquely defined up to a constant by the set of its geodesics (affine rigidity)? And by the set of its geodesics up to reparameterization (projective rigidity)? In the Riemannian case the local classification of projectively and affinely rigid metrics is classical (Levi-Civita, Eisenhart). These classification results were extended to contact and quasi-contact distributions by Zelenko. Our general goal is to extend these results to arbitrary sub-Riemannian manifolds, and we establish two types of results toward this goal: if a sub-Riemannian metric is not projectively conformally rigid, then, first, its flow of normal extremals has at least one nontrivial integral quadratic on the fibers of the cotangent bundle and, second, the nilpotent approximation of the underlying distribution at any point admits a product structure. As a consequence we obtain genericity results for the rigidity. This is a joint work with I. Zelenko and S. Maslovskaya.