  Probing the evolution of the universe at high redshifts with standard candles
is a powerful way to discriminate dark energy models, where an open question
nowadays is whether this component is constant or evolves with time. One
possible source of ambiguity in this kind of analyses comes from cosmic
opacity, which can mimick a dark enery behaviour. However, most tests of cosmic
opacity have been restricted to the redshift range $z<2$. In this work, by
using luminosity distances of gamma-ray bursts (GRBs), {given the validity of
the Amati relation}, and the latest $H(z)$ data we determine constraints on the
cosmic opacity at high redshifts ($z>2$) for a flat $\Lambda$CDM model. A
possible degenerescence of the results with the adopted cosmological model is
also investigated by considering a flat XCDM model. The limits on cosmic
opacity in the redshift range $0<z<2$ are updated with type Ia supernovae (SNe
Ia) from the Union2.1 sample, where we added the most distant ($z=1.713$)
spectroscopically confirmed SNe Ia. From the analyses performed, we find that
both SNe Ia and GRBs samples are compatible with a transparent universe at
$1\sigma$ level and the results are independent of the dark energy equation of
state parameter $w$.
