Solution (source code)

= Solution

Varying the gauge-fixed <Polyakov action> gives the bulk wave equation and the boundary term
$$
\delta S_{\partial\Sigma}=-\frac1{2\pi\alpha'}
\int d\tau\,\delta X_\mu\partial_\sigma X^\mu\bigg|_{0}^{\pi}.
$$
It vanishes in each target direction either through the <Neumann boundary condition>
$$
\partial_\sigma X^\mu|_{\sigma=0,\pi}=0,
$$
or through the <Dirichlet boundary condition>
$$
\delta X^I|_{\sigma=0,\pi}=0,
$$
which fixes the endpoint positions.