To avoid glare from the headlights of an approaching car:

You should avoid looking toward the bright lights of an oncoming vehicle by glancing toward the right side of the road. After looking briefly toward the side of the road, continue looking ahead to check on the position of the other vehicle.
DMV Writen Test