The source may be Sanhedrin 98a.
ר' יהושע בן לוי אשכח לאליהו דהוי קיימי אפיתחא דמערתא דרבי שמעון בן יוחאי אמר ליה אתינא לעלמא דאתי אמר ליה אם ירצה אדון הזה אמר רבי יהושע בן לוי שנים ראיתי וקול ג' שמעתי אמר ליה אימת אתי משיח אמר ליה זיל שייליה לדידיה והיכא יתיב אפיתחא דקרתא ומאי סימניה יתיב ביני עניי סובלי חלאים וכולן שרו ואסירי בחד זימנא איהו שרי חד ואסיר חד אמר דילמא מבעינא דלא איעכב אזל לגביה אמר ליה שלום עליך רבי ומורי אמר ליה שלום עליך בר ליואי א"ל לאימת אתי מר א"ל היום אתא לגבי אליהו א"ל מאי אמר לך א"ל שלום עליך בר ליואי א"ל אבטחך לך ולאבוך לעלמא דאתי א"ל שקורי קא שקר בי דאמר לי היום אתינא ולא אתא א"ל הכי אמר לך (תהלים צה, ז) היום אם בקולו תשמעו
Rabbi Yehoshua ben Levi met Eliyahu standing at the entrance of the cave of Rabi Shimon bar Yochai.
He (R' YbL) said to him, "Will I have a portion in the World to Come?"
He (Eliyahu) said to him, "If this Master (the Shechina -Rashi) wants".
Rabbi Yehoshua ben Levi said, "I saw two and the voice of a third (the Shechinah -Rashi) I heard."
He (R' YbL) said to him, "When will the messiah come?"
He (Eliyahu) said to him, "Go ask him."
(R' YbL)"And where does he sit?"
(Eliyahu) "And the gates of the city."
(R' YbL) "And what is his sign?"
(Eliyahu) "He sits between the poor, those suffering of sickness. And all of them remove [their bandages] and tie them on at one time. And he removes one and ties one on [because] maybe he will be needed, so that he shouldn't be delayed."
He (R' YbL) went to him (the messiah). He (R' YbL) said to him, "Peace to you my rabbi and my master."
He (the messiah) said to him, "Peace to you son of Levi".
(R' YbL) "He said to him, "When is the master coming?"
He (the messiah) said to him, "Today."
He (R' YbL) came to Eliyahu. He (Eliyahu) said to him, "What did he tell you?"
He (R' YbL) said to him, "Peace to you son of Levi."
He (Eliyahu) said to him, "I ensure for you and your father [a place] in the World to Come."
He (R' YbL) said to him, "He lied to me, that he said to me, 'today I will come'."
He (Eliyahu) said to him, "This is what he said to you, "Today if you listen to My Voice (Psa. 95:7)
Rashi there says:
those suffering of sickness: They are wounded. And he is also wounded as its written, "And he was pained from our sins (Isa. 53:4)" and "Our sickness he carries (ibid.)"
Unfortunately I don't own one of the nice Ein Yaakov's. In there is a bit more of an explanation of what it means that Moshiach (or any tzaddik) suffers for the nation.