In general you can not expect that $f$ will be flat on $X-U$, but you have a locally finite stratification of $X$ for which $U$ is the dense stratum, and such that $f$ is flat over each strata. This notion is called "platification" (in French) and it was dealed with great details in the paper of Gruson and Raynaud "Techniques de platification d'un module".
In general you can not expect that $f$ will be flat on $X-U$, but you have a locally finite stratification of $X$ such that $f$ is flat over each strata. This notion is called "platification" (in French) and it was dealed with great details in the paper of Gruson and Raynaud "Techniques de platification d'un module".