Let us consider the Klein-Gordon equation 
$$(\Box +m^2)u=0,$$
where $u$ is a scalar valued function, $m\geq 0$, $\Box=\frac{\partial^2}{\partial x_0^2}-\sum_{i=1}^d\frac{\partial^2}{\partial x_i^2}$.

In the physics literature, in particular in QFT, one sometimes says that if the unknown function $u$ satisfies boundary conditions then $u=0$.

**Question. What exactly boundary conditions guarantee vanishing of $u$?** 

I am mainly interested in such conditions of physical interest, say used in QFT.

**UPDATE.** Below is a concrete example of a situation of interest. In comments I briefly describe yet another situation which is typical for QFT and more interesting, but mathematically unrigorous. As I was told, the second situation is not appropriate for this site.

Consider now the classical (i.e. not quantized) free electromagnetic field $A_\nu$. It satisfies the equation
$$\Box A_\nu-\partial_\nu (\partial\cdot A)=0.$$
It is gauge invariant, i.e. $A_\nu+\partial_\nu f$ satisfies the same equation for any function $f$. Under a change under such a gauge transformation we may assume that $\partial\cdot A=0$ (Lorentz gauge). Then the equations become
$$\Box A_\nu=0,\,\,\, \partial\cdot A=0.$$
It is still invariant under adding to $A_\nu$ the expression $\partial_\nu f$ where $\Box f=0$. **What are the natural boundary conditions on all the electromagnetic fields which would guarantee that $f=0$?**