Abdullah bin Abbas reported,

The Messenger of Allah ﷺ set out on a journey while fasting, and continued fasting until he reached Usfan. Then he called for a vessel and drank from it during the day so that people could see him, and he broke his fast until he entered Mecca. He conquered Mecca during Ramadan.Ibn Abbas said, "The Messenger of Allah ﷺ both fasted and broke his fast while traveling, so whoever wishes may fast, and whoever wishes may break his fast."

Nasai 2316

Sahih

أخبرنا محمد بن رافع قال حدثنا يحيى بن آدم قال حدثنا مفضل عن منصور عن مجاهد عن طاوس

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

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

النسائي 2316صحيح
Contents
Reference
Commentary
Ayat
Collection
Sunan Nasai Sughra
Book
Fasting
Chapter
Concession for one who was present in Ramadan and fasted, then traveled, to break the fast
Numbering
Darussalam 2316
Nasai 2316