# Conditions for allowed modes in Quantization of an EM Field

Usualy, when quantizing a free Electromagnetic Field, the first thing we do is solve the classical Maxwell Equations, to get a full set of modes (solutions of the equations) that are then used to expand the quantized field.

However, for different situations, I encountered different modes that are choosen:

For an abitrary volume, one chooses complex plane waves $e^{i(\omega t - \vec{k}\vec{x})}$. For a cavity, one chooses real standing waves: $\sin(k_x x) \sin(k_y y) \sin(k_z z)$, and for a cavity with partially reflecting mirrors inside, one chooses a complicated superposition of plane waves, as shown in this answer.

My question is: What are the Boundary Conditions that modes have to satisfy, if you want to use them to quantize an EM field? For an arbitrary Volume, it seems that periodic boundary conditions are sufficient, but for a cavity, one demands the field to be zero at the boundary.

Is there a general rule on what conditions to demand? In particular, I'm interested in the boundary conditions to apply for laser cavity, with one full reflective and one partially reflective mirror, and a quantization volume that exceeds the length of the cavity on the side of the partially reflective mirror.