We have performed electroreflectance and photoreflectance studies of Pt/GaN Schottky diodes with Ga- and N-face polarity as well as AlGaN/GaN based transistor heterostructures. The experimental data were analyzed using electric field-dependent dielectric functions of GaN and AlGaN. Inhomogeneities in the electric fields were taken into account by application of a multi-layer formalism. We observed an increase of the electric field strength underneath the Schottky contact and in the AlGaN barrier with increasing temperature. The results are explained in terms of temperature dependent densities of ionized impurities and surface charges.