Are you misunderstanding something? Clothes Railings are "normally" fixed on the ends (to the wall of the cupboard) or from above and can thus, be positioned any distance from the rear wall.
Do an Image Search for "Clothes Railing U Bracket" for example.