Gravity exerts a force on photons, even though it has no mass. This can distort the things we see if the light that reaches us is being distorted by gravity, as seen in the picture at the top of this post. The confusing aspect of this is that gravity affects this light even though the light has no mass. This is explained in Einstein’s Theory of Special Relativity that gravity is not pulling the light, but it is rather changing the geometry and physical laws of time and space around it. This means that the light that is affected by gravity is still moving in a straight line, but the planet or other massive object whose gravity is affecting it is changing what a straight line is. Also, rather than accelerating on its path when affected by gravity, light just changes in its frequency, because it always moves at a constant speed that does not change. This is what causes the blue shift and red shift in light. When moving towards the massive object, there would be a blue shift in the light because the frequency would increase, and if moving away from the massive object, there would be a red shift. Here is a video explaining this in more detail and here is the link to the picture.
How Gravity Affects Light
