Rainbow is always formed in a direction opposite to that of the sun.
A rainbow is formed when a raindrop cause the light to have total internal reflection, this means the light is reflected back in the direction it originally came from. Hence, we can only see a rainbow if our back is facing the sun.