An exact analytic representation of the critical state of a current-carrying type-II superconductor strip located inside a cylindrical magnetic cavity of high permeability is derived. The obtained results show that, when the cavity radius is small, penetration of magnetic flux fronts is strongly reduced as compared to the situation in an isolated strip. From our generic representation it is possible to establish current profiles in closed cavities of various other geometries too by means of conformal mapping of the basic configuration addressed.