The polariton Hamiltonian for a quantum well embedded in a cavity of finite width is derived. The exciton-light interaction is formulated in second quantization and the photon self-interaction term A2 is included. The importance of the A2 term turns out to be relevant in the case of large values of the cavity width. By solving the equation of motion the dispersion relations for upper and lower polaritons are found. A comparison is made with existing measurements of polariton absorption peaks. The limit of infinite cavity width is carried out and the known results for a quantum well in an infinite medium are recovered.