The gravitational field of supermassive black holes is able to strongly bend light rays emitted by nearby sources. When the deflection angle exceeds $pi$, gravitational lensing can be analytically approximated by the so-called strong deflection limit. In this paper we remove the conventional assumption of sources very far from the black hole, considering the distance of the source as an additional parameter in the lensing problem to be treated exactly. We find expressions for critical curves, caustics and all lensing observables valid for any position of the source up to the horizon. After analyzing the spherically symmetric case we focus on the Kerr black hole, for which we present an analytical 3-dimensional description of the higher order caustic tubes.