Anas bin Sirin reported,

We met Anas bin Malik when he came to Sham, meeting him at Ayn al-Tamr. I saw him praying on a donkey while his face was turned in that direction. Hammam gestured to indicate it was to the left of the qiblah.I said to him, "I saw you praying toward other than the qiblah."He replied, "Had I not seen the Messenger of Allah ﷺ doing it, I would not have done it."

Muslim 1620

Sahih

و حدثني محمد بن حاتم حدثنا عفان بن مسلم حدثنا همام حدثنا

أنس بن سيرين قال

تلقينا أنس بن مالك حين قدم الشام فتلقيناه بعين التمر فرأيته يصلي على حمار ووجهه ذلك الجانب وأومأ همام عن يسار القبلة فقلت له رأيتك تصلي لغير القبلة قال لولا أني رأيت رسول الله ﷺ يفعله لم أفعله

مسلم 1620صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Muslim
Book
Travelers' prayer and its shortening
Chapter
Permissibility of praying voluntary prayers on a mount while traveling, whichever direction it faces
Numbering
Darussalam 1620
Muslim 1620