Q:

Why do we know that light must follow a geodesic?

THE CONTEXT:
Some context to my question: Einstein once posed the thought experiment of a man falling inside a closed box. Just before the box was dropped, a photon was fired horizontally moving from the man's left.towards his right..By the equivalence principle, the man has no.way to realise he is falling in a gravitational field..To him, it is as if he is in zero gravity. But that would mean that he must "see" the photon continue to move from his left to his right, HORIZONTALLY. But then consider another man outside the box who is not falling. To him the same photon must follow a curve.
This is where the geodesic question comes in. If you know that light.must  always follow the geodesic, and that light is following a curve, then that automatically implies that space must be curved, since a geodesic in flat space is a straight  line. But, if there was no evidence that light followed a geodesic; then it could be thought that space is flat, but light is simply taking a curved path in flat space.  
MY QUESTION:
So my question is this: If we put general relativity itself to one side, what evidence tells us that light must travel along a geodesic? Is it possibly the principle of Snell Law that the optical path is a stationary point?

A:

Fermat's pronciple states that a ray of light takes the path traversed in the least time (or more precisely, in stationary time). This is a consequence of the principle of stationary action.
In a free metric spacetime, a geodesic defines the shortest interval between two events. The geodesic equation is obtained using the principle of stationary action with the metric (or equivalently its square root) as the Lagrangian. This implies a movement in empty space with no external forces.
By varying this action we obtain the Euler-Lagrange equations for geodesics in the given spacetime. Depending on the type of the interval (timelike, lightlike, or spacelike), we get three corresponding types of geodesics.
So yes, Fermat's principle in a free metric spacetime is equivalent to the fact that light travels along null geodesics.

