Sahih al-Bukhari 1948
Narrated Tawus:
Ibn 'Abbas said, "Allah's Apostle set out from Medina to Mecca and he fasted till he reached 'Usfan, where he asked for water and raised his hand to let the people see him, and then broke the fast, and did not fast after that till he reached Mecca, and that happened in Ramadan." Ibn 'Abbas used to say, "Allah's Apostle (sometimes) fasted and (sometimes) did not fast during the journeys so whoever wished to fast could fast, and whoever wished not to fast, could do so."
حَدَّثَنَا مُوسَى بْنُ إِسْمَاعِيلَ، حَدَّثَنَا أَبُو عَوَانَةَ، عَنْ مَنْصُورٍ، عَنْ مُجَاهِدٍ، عَنْ طَاوُسٍ، عَنِ ابْنِ عَبَّاسٍ ـ رضى الله عنهما ـ قَالَ خَرَجَ رَسُولُ اللَّهِ ﷺ مِنَ الْمَدِينَةِ إِلَى مَكَّةَ، فَصَامَ حَتَّى بَلَغَ عُسْفَانَ، ثُمَّ دَعَا بِمَاءٍ فَرَفَعَهُ إِلَى يَدَيْهِ لِيُرِيَهُ النَّاسَ فَأَفْطَرَ، حَتَّى قَدِمَ مَكَّةَ، وَذَلِكَ فِي رَمَضَانَ فَكَانَ ابْنُ عَبَّاسٍ يَقُولُ قَدْ صَامَ رَسُولُ اللَّهِ ﷺ وَأَفْطَرَ، فَمَنْ شَاءَ صَامَ، وَمَنْ شَاءَ أَفْطَرَ.