Just as one standing before the king would not have the audacity to spit, so too it is forbidden to spit during the Shemoneh Esrei. One should swallow the saliva in his mouth. If it is impossible for him not to spit, such as with phlegm or mucus, if it is possible for him to swallow the saliva in his clothing, such as in an undergarment, or if he has a kerchief with which he wipes the nose and saliva—he should spit into it. But in an outer garment where the saliva will be seen—he should not swallow it. If he is an istanis, and his mind is repulsed by doing so—he throws the saliva behind him. The Rambam wrote: he throws it with his hand behind him, and the implication is that he should spit into his hand and throw it behind him, and he should not turn his head backward. But the Tur and the Shulchan Aruch, section 2, wrote: he throws it behind him, meaning: that he should turn his head and spit. And in his great book, he questioned the interpretation of the Rambam: for since he is an istanis who cannot swallow it in his clothing, how could he take it in his hands? For this reason, he wrote that the intention of the Rambam is also by means of a kerchief, and when he does not have a kerchief in his hand—he should throw it thus, see there. But I do not understand: for certainly it is so, that to take the saliva in his hand for a moment and throw it—there is no issue of istanisut in this. This is not the case with swallowing it in clothing where the saliva will certainly remain there—the mind cannot tolerate this when one is an istanis, and the senses testify to this. It requires further study. Therefore, it appears in my humble opinion to be concerned for the words of the Rambam, and to spit into the hand and throw it behind him. And it is simple that just as the law is regarding saliva—so it is regarding mucus of the nose. And even though it was explained in siman 92 that one who touches mucus of the nose requires washing, we explained there that it is sufficient to clean it on a wall, see there. And this fact that they permitted him to spit when he is forced to do so is because it is better that he should pray in cleanliness than that he should suffer and have a distraction in his prayer (Tosafot R"i). And so it is explained in the Yerushalmi. And know that the supplications after the prayer are like the prayer regarding spitting, as long as he has not stepped the three steps. For as long as he has not stepped—he is like one standing before the king (Magen Avraham, subsection 2).
וכשם שהעומד לפני המלך לא יעיז פניו לרוק, כמו כן אסור לרוק בשמונה עשרה. ויבליע הרוק בפיו. ואם אי אפשר לו שלא לרוק כמו כיחו וניעו, אם אפשר לו להבליע הרוק בכסותו כמו בבגד התחתון, או שיש לו סודר שמקנח בו האף והרוק – ירוק בו. אבל בבגד העליון שיתראה הרוק – אין לו להבליעו. ואם הוא איסטניס, ודעתו קצה עליו לעשות כן – זורק הרוק לאחוריו. והרמב"ם כתב: זורקו בידו לאחוריו, ומשמע שירוק ביד ויזרקנו לאחוריו, ולא יחזיר הראש לאחוריו. אבל הטור וחשולחן ערוך סעיף ב כתבו: זורקו לאחוריו, כלומר: שיחזיר הראש וירוק. ובספרו הגדול הקשה על פירושו של הרמב"ם: דכיון דאסטניס הוא שאינו יכול להבליעו בכסותו, איך יעלו בידיו? ולזה כתב דכוונת הרמב"ם הוא גם כן על ידי סודר, וכשאין בידו סודר – יזרקנו כך, עיין שם. ולא אבין: דוודאי כן הוא דליקח הרוק בידו על רגע ולזורקו – אין בזה אסטניסות. מה שאין כן הבלעה בכסות שהרוק יהיה שם בוודאי – אין הדעת סובלת כשהוא אסטניס, והחוש מעיד כן. וצריך עיון. ולכן נראה לעניות דעתי לחוש לדברי הרמב"ם, ולרוק ביד ויזרקנו לאחוריו. ופשוט הוא דכמו שהדין ברוק – כן הוא בצואת האף. ואף שנתבאר בסימן צ"ב דהנוגע בצואת האף צריך נטילה, הא בארנו שם דדי במנקה בכותל, עיין שם. וזה שהתירו לו לרוק כשמוכרח לכך, מפני שיותר טוב הוא שיתפלל בנקיות משיצטער ויהיה לו בלבול בתפילתו (תוספות ר"י). וכן מבואר בירושלמי. ודע דתחנונים שאחר התפילה הם כתפילה לענין רוק, כל זמן שלא פסע השלוש פסיעות. דכל זמן שלא פסע - הוה ליה כעומד לפני המלך (מגן אברהם סעיף קטן ב').