narrated tawus (radi-allahu 'anhu):
ibn 'abbas said, "allah's apostle (sallallahu 'alaihi wa sallam) set out from medina to makkah 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 makkah, and that happened
in ramadan." ibn 'abbas used to say, "allah's apostle (sallallahu 'alaihi wa sallam) (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."
bukhari vol. 3 : no. 169