Sahih Muslim Book 6, Hadith 50
'Abdullah b. 'Amir b. Rabi'a has reported on the authority of his father that he had seen the Messenger of Allah (ﷺ) observing Nafl player at night on a journey on the back of his ride in whichever direction it turned its face.
Salim b. 'Abdullah reported on the authority of his father that the Messenger of Allah (may peace be. upon him) used to observe Nafl (supererogatory) prayer on his ride no matter in what direction it turned its face, and he observed Witr too on it, but did not observe obligatory prayer on it.
We met Anas b. Malik as he came to Syria at a place known as 'Ain-al-Tamar and saw him observing prayer on the back of his donkey with his face turned in that direction. (Hammam one of the narrators) pointed towards the left of Qibla, so I said to him: I find you observing prayer towards the side other than that of Qibla. Upon this he said: Had I not seen the Messenger of Allah (ﷺ) doing like this, I would not have done so at all.