Let $f:X\longrightarrow Y$ be a morphism of noetherian schemes. Under what conditions is $f_\ast \mathcal{O}_X$ a locally free $\mathcal{O}_Y$-module?

**Example 1**. Suppose that $f$ is affine. Then $f_\ast\mathcal{O}_X$ is a quasi-coherent $\mathcal{O}_Y$-module.

**Example 2**. Suppose that $f$ is finite. Then $f_\ast \mathcal{O}_X$ is even coherent.

**Example 3**. Suppose that $f:X\longrightarrow Y$ is a finite morphism of regular integral 1-dimensional schemes. Then $f_\ast \mathcal{O}_X$ is coherent and locally free. (The local rings $\mathcal{O}_{Y,y}$ are discrete valuation rings.)

In view of the above examples, I'm basically looking for a higher-dimensional analogue of Example 3. But, I don't require quasi-coherence in my question. (Although this is quite unnatural.)

**Idea**. For any finite morphism $f:X\longrightarrow Y$, we have that $f_\ast \mathcal{O}_X$ is locally free. Only what are the precise conditions on $X$ and $Y$?