From Sahih Bukhari (Hadith 1943):
Narrated `Aisha:(the wife of the Prophet) Hamza bin `Amr Al-Aslami asked the Prophet, "Should I fast while traveling?" The Prophet (ﷺ) replied, "You may fast if you wish, and you may not fast if you wish
Reference: Bukhari 1943