When you cast the solid-box variant of forcecage, the spell specifies:
A prison in the shape of a box can be up to 10 feet on a side, creating a solid barrier that prevents any matter from passing through it and blocking any spells cast into or out of the area.
Clearly this stops a single-target spell like fire bolt from affecting anything inside the box if it's cast from outside the box.
But does it stop an area-of-effect spell like cloudkill or daylight, cast on a point just outside the box, from affecting creatures or objects within the box?
Best Answer
Forcecage stops any area of effects from entering or exiting it
PHB p. 204 explains how to determine if something is considered part of an AoE or not, under the "Areas of Effect" heading (or here in the basic rules):
And the box of force counts as a source of full cover, per the rules for Cover (PHB p. 196, or here in the basic rules):
The area inside the box, being completely surrounded by the box, effectively has full cover against all spells and spell effects no matter if they are targeted or AOE. No "unblocked straight line" can possibly get from the outside of a box to the inside. It is physically obstructed from all sides.
The only exceptions to this are spells which ignore cover completely, including total cover, such as sacred flame.