The pain comes from disc compression while bending backwards. When bending backwards, the disc above the herniated disc compresses downward, causing pain, therefore the herniated disc should be a protruding herniation. Double check by having someone run their hand over the spine to see if there is any protrusion. The protrusion would be the outwardly herniated disc. To remedy it, gently push the outwardly protruding herniated disc inwardly until the protrusion disappears.
If one bends forwards and does not hurt, that would be because the disc above the herniated disc is being bent forward away from the herniation and there is no compression on the herniated disc.