The back side of our new bathroom door has two towel rails integrated into it.
These towel rails are a little different, though. The "rail" part is actually two sets of aluminum tubing that have been cut in the center and have a bungee chord pulled tight inside. The idea is that when you bump the rail while in the tight quarters of the bathroom stall the towel rail will bend at the cut point in the middle and pop back into place instead of either permanently bending the rail or bruising your anatomy.
Each "rail is actually made from four lengths of aluminum tube, a 1/4" diameter tube on the outside and a second tube that just barely slides in on the inside. (You can buy 36" lengths of thin wall aluminum tubing like this at many hobby stores.) The combined length of inner and outer pair of tubes are the same, but they're not cut at the same center point: they're cut about 3/16" off from one another, so they "nest" into each other and create a seamless look.
The bungee chord is fed through the aluminum tubes into a small hole in the wood block at either end of the rod. The cord is pulled quite tight, folded over on itself, and 3/4" or so fed back into the larger hole on the other side of the block. In the prototype towel rail I had on the old bathroom door friction and the tension on the bungee cord held it in place, but here I added a splotch of urethane glue that all but guarantee the towel rail bungee wont slip and snap through somewhere down the road.