Granny M, I think energizer has hit on something. Could be exertion induced migraine. The magnesium supplement idea is a good one if this is the case. Slow release niacin (a B vitamin) is also worth pursuing. You'll have to check with your pharmacist for the slow-release kind.
I know it sounds goofy but you might try taking a couple of aspirin and drinking a Coke or Pepsi (regular, not diet) before you ride. I've suffered from migraine headaches for 25 years and sometimes the combo of aspirin, caffeine, and sugar will actually ward off a migraine.I think the caffeine and sugar just help to get the aspirin in your system faster.
I wish you luck because I feel your pain, literally!
-traveller
"It never gets easier, you just go faster." -- Greg LeMond