So the problem is that your map $f$ is not surjective.
However, $f$ is locally surjective in the following sence:
If $\Omega$ is the interior of $C$, $x\in \Omega$ and $\varepsilon>0$ is such that $B_\varepsilon(x)\subset \Omega$ then the restriction $f|_{B_\varepsilon(x)}$ is a bijection from $B_\varepsilon(x)\to B_\varepsilon(f(x))$. This is true since the distance preserving map has to be volume preserving and $\mathrm{vol}\,B_\varepsilon(x)=\mathrm{vol}\,B_\varepsilon(f(x))$.
This local surjectivity can exchange the surjectivity in the proof of JvaisalaJväisälä given here (the only proof of Mazur--Ulam'sMazur–Ulam's theorem I know). It gives the following: assume $B_{100{\cdot}|x-y|}(x)\subset \Omega$ then $$f\left(\frac{x+y}2\right)=\frac{f(x)+f(y)}{2},$$ i.e., the map $f$ is a restriction of affine map to $C$. Hence everything follows.