In thin-film interference and in glass fibers refraction is involved. Depending on the angle of which a light ray enters the material it will be reflected or transmitted. The refraction depends on the different materials like air and water, glass or oil.
But as far as I know the reflection happens within the material of the thin-film or the glass. So from that point of view that photon haven't 'seen' or 'felt' the material on the other side of that material which refraction index would reflect them. So when a photon is reflected before he 'knows' the other material (as he is reflected by the atoms of the same material as he went in) how does he 'know' that he 'has' to bounce back?