Relativistic jets associated with long/soft gamma-ray bursts are formed and initially propagate in the interior of the progenitor star. Because of the subsequent loss of their external pressure support after they cross the stellar surface, these flows can be modelled as moving around a corner. A strong steady-state rarefaction wave is formed, and the sideways expansion is accompanied by a rarefaction acceleration. We investigate the efficiency and the general characteristics of this mechanism by integrating the steady-state, special relativistic, magnetohydrodynamic equations, using a special set of partial exact solutions in planar geometry (r self-similar with respect to the ‘corner’). We also derive analytical approximate scalings in the ultrarelativistic cold/magnetized, and hydrodynamic limits. The mechanism is more effective in magnetized than in purely hydrodynamic flows. It substantially increases the Lorentz factor without much affecting the opening of the jet; the resulting values of their product can be much greater than unity, allowing for possible breaks in the afterglow light curves. These findings are similar to the ones from numerical simulations of axisymmetric jets by Komissarov et al. and Tchekhovskoy et al., although in our approach we describe the rarefaction as a steady-state simple wave and self-consistently calculate the opening of the jet that corresponds to zero external pressure.