This work reports the preparation of glass-like, environmentally-friendly, cerium-based coatings for active corrosion protection of aluminium and magnesium alloys. It describes the production of cerium sol-gel sols from cerium nitrate and their deposition by immersion and automatic spray onto aluminium and magnesium alloys to produce uniform coatings with amorphous (glass-like) structures (CexOy). The coatings have been characterised by profilometry, scanning electron microscopy (SEM), spectral ellipsometry and UV-visible, in order to analyse the structure and density of the glass-like cerium coatings as well as their redox ratio Ce4+/Ce3+ as a function of pH and sintering temperature. Finally, electrochemical measurements (EIS) and standard corrosion tests (neutral salt spray, filiform corrosion, immersion-emersion test and adhesion on embossing and T-bend test) have been performed to study the corrosion behaviour of the cerium glass-like coatings on aluminium and magnesium alloys. EIS measurements confirm the healing or blocking of the defects by the corrosion inhibiting species. Excellent corrosion protection is provided by cerium glass-like coatings, satisfying the most demanding industrial requirements. (C) 2011 Elsevier B.V. All rights reserved.