How long are the rides?

Some possible culprits: dehydration and lack of energy (food).

Does the headache start as soon as you get onto a climb, or does it start after you've been climbing a bit?