Suppose that we have a variational problem,
$\int_{t_1}^{t_2}f(\vec{x}(t),\vec{x}'(t),|\vec{x}(t)|)dt$
subject to the constraint:
$|\vec{x}|=1$
where $\vec{x}(t)=\left\{x_1(t),x_2(t),x_3(t) \right\}.$ Are we allowed to rewrite the integral as
$\int_{t_1}^{t_2}f(\vec{x}(t),\vec{{x}'}(t),1)dt$
and continue with the conventional variational calculus procedure with Lagrange multiplier (i.e., substituting the constraint before taking the variational derivatives) ?