Abdullah bin Umar reported,

The Prophet ﷺ used to position his mount in front of him and pray facing it.Nafi asked, "What did he do when the riding-camels became restless?"He replied, "He would take the saddle and set it upright, then pray facing its rear end," or he said, "its back part." Ibn Umar used to do the same.

Azami 2518

Sahih

عن ابن عمر

عن النبي ﷺ أنه كان يعرض راحلته فيصلي إليها. قال نافع: أفرأيت إذا هبت الركاب؟ قال: كان يأخذ هذا الرحل فيعدله فيصلي إلى آخرته- أو قال: مؤخره- وكان ابن عمر يفعله.

الأعظمي 2518صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Prayer
Chapter
Sutrah
Section
Seeking to pray toward a sutrah such as a pillar and the like
Numbering
Jami al-Kamil 2518 (2nd edition)
Azami 2518