How migrating cells differentially adapt and respond to extracellular track geometries remains unknown. Using intravital imaging, we demonstrate that invading cells exhibit dorsoventral (top-to-bottom) polarity in vivo. To investigate the impact of dorsoventral polarity on cell locomotion through different confining geometries, we fabricated microchannels of fixed cross-sectional area, albeit with distinct aspect ratios. Vertical confinement, exerted along the dorsoventral polarity axis, induces myosin II–dependent nuclear stiffening, which results in RhoA hyperactivation at the cell poles and slow bleb-based migration. In lateral confinement, directed perpendicularly to the dorsoventral polarity axis, the absence of perinuclear myosin II fails to increase nuclear stiffness. Hence, cells maintain basal RhoA activity and display faster mesenchymal migration. In summary, by integrating microfabrication, imaging techniques, and intravital microscopy, we demonstrate that dorsoventral polarity, observed in vivo and in vitro, directs cell responses in confinement by spatially tuning RhoA activity, which controls bleb-based versus mesenchymal migration.