We trace the history of atmospheric refraction from the ancient Greeks up to the time of Kepler. The concept that the atmosphere could refract light entered Western science in the second century B.C. Ptolemy, 300 years later, produced the first clearly defined atmospheric model, containing air of uniform density up to a sharp upper transition to the ether, at which the refraction occurred. Alhazen and Witelo transmitted his knowledge to medieval Europe. The first accurate measurements were made by Tycho Brahe in the 16th century. Finally, Kepler, who was aware of unusually strong refractions, used the Ptolemaic model to explain the first documented and recognized mirage (the Novaya Zemlya effect).