Abdullah bin Abbas reported,

The Messenger of Allah ﷺ set out from Medina heading to Mecca and was fasting until he reached Usfan. Then he called for water, raised it up in his hands so the people could see, and broke his fast. He remained not fasting until he arrived in Mecca. This took place during Ramadan.Ibn Abbas used to say, "The Messenger of Allah ﷺ both fasted and broke his fast on this journey, so whoever wishes may fast, and whoever wishes may break his fast."

Azami 4600

Sahih

عن ابن عباس، قال

خرج رسول الله ﷺ من المدينة إلى مكة، فصام حتى بلغ عسفان، ثم دعا بماء، فرفعه إلى يديه يريه الناس، فأفطر حتى قدم مكة. وذلك في رمضان. فكان ابن عباس يقول: قد صام رسول الله ﷺ وأفطر، فمن شاء صام، ومن شاء أفطر.

الأعظمي 4600صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Fasting
Chapter
What is permitted and what is not permitted for the fasting person
Section
Recommendation of breaking the fast while traveling in order to gain strength for fighting, serving one's companions, and similar matters
Numbering
Jami al-Kamil 4600 (2nd edition)
Azami 4600