It has been suggested that relativistic shocks in extragalactic sources may accelerate the highest energy cosmic rays. The maximum energy to which cosmic rays can be accelerated depends on the structure of magnetic turbulence near the shock but recent theoretical advances indicate that relativistic shocks are probably unable to accelerate particles to energies much larger than a PeV. We study the hotspots of powerful radiogalaxies, where electrons accelerated at the termination shock emit synchrotron radiation. The turnover of the synchrotron spectrum is typically observed between infrared and optical frequencies, indicating that the maximum energy of non-thermal electrons accelerated at the shock is < TeV for a canonical magnetic field of ~100 micro Gauss. Based on theoretical considerations we show that this maximum energy cannot be constrained by synchrotron losses as usually assumed, unless the jet density is unreasonably large and most of the jet upstream energy goes to non-thermal particles. We test this result by considering a sample of hotspots observed with high spatial resolution at radio, infrared and optical wavelengths.