Why does each mode of the electromagnetic field have two degrees of freedom? In the derivation of the Rayleigh-Jeans law, using the Equipartition theorem the number of modes per unit frequency per unit volume is multiplied by $kT$, which implies each electromagnetic resonant mode has two degrees of freedom.
I've considered them being the amplitude of the electric field and the amplitude of the magnetic field, but they're both proportional in a vacuum. 
I've also considered it being the two possible polarizations of each mode, but that is already accounted for when the modes are being counted.
 A: This is a nice question, glossed over in many textbooks! Let's start with the electromagnetic field Hamiltonian,
$$H \sim \frac12 \left(E^2 + B^2\right).$$
Naively one would say that $\mathbf{E}$ and $\mathbf{B}$ are the two degrees of freedom, giving the factor of two. But as you noted, this isn't correct. The fields $\mathbf{E}$ and $\mathbf{B}$ are not conjugate phase space variables, so the reasoning does not go through in analogy to the harmonic oscillator
$$H \sim \frac12 \left(p^2 + \omega^2 x^2 \right).$$
Indeed $\mathbf{E}$ and $\mathbf{B}$ are instead proportional, as you noted. Another indication something is wrong is that there should be an $\omega^2$ in front of one of the terms.
A mode of the electromagnetic field really is analogous to a harmonic oscillator, but the argument requires more care. We note that $\mathbf{E}$ is the conjugate momentum to $\mathbf{A}$, and rewrite the Hamiltonian in terms of these variables. We use $\mathbf{B} = \nabla \times \mathbf{A}$ and work in Coulomb gauge $\nabla \cdot \mathbf{A} = 0$, which removes one of the polarizations. Dropping all constants, integrating by parts, and using $\omega^2 = k^2$, we find
$$H \sim \frac12 (E^2 + \omega^2 A^2).$$
This is indeed a harmonic oscillator, giving the desired factor of $2$. 
A: The classical equipartition theorem for a one-dimensional harmonic oscillators gives a mean kinetic energy of $\frac{k}{2}$ and a mean potential energy $\frac{k}{2}$ so that the total mean energy is $k$. Analogously, the electromagnetic modes can be considered as harmonic oscillators which have a total mean energy (kinetic and potential) of $k$.  
