The Messenger of Allah ﷺ said, "When you are in prayer, do not spit to your right. Instead, spit behind you, or to your left, or under your left foot."
حدثنا محمد بن بشار حدثنا يحيى بن سعيد عن سفيان عن منصور عن ربعي بن حراش
قال رسول الله ﷺ إذا كنت في الصلاة فلا تبزق عن يمينك ولكن خلفك أو تلقاء شمالك أو تحت قدمك اليسرى
[Its chain of transmission is sahih] Nasai also reported it: 22/52, no. 727, Book of Mosques, Chapter on the permission for the one praying to spit behind himself or to his left, from the hadith of Yahya Qattan, from him, and Sufyan Thawri explicitly stated that he heard it. Ibn Khuzayma graded it sahih, no. 876.There are also narrations on this subject from Abu Saeed [Bukhari, no. 408, and Muslim, no. 548], Ibn Umar [Bukhari, no. 406, and Muslim, no. 547], Anas [coming at 572], and Abu Hurairah [Bukhari, no. 408, 409, and Muslim, no. 550].Waki said regarding Rubai, its chain of transmission is sahih. 408, 409.