Well, I'm not sure if someone mentioned this or not... but...
I know for me, sometimes my headaches DO NOT COME FROM DEHYDRATION.
For example, this past Sat. I rode in 80 degree heat (nothing for Texas), for 40 miles with lots of hills.
Before the ride, from 7:30 AM to 11:00 AM I ate 800 caloires. During the ride from 11:00 AM to 2:30/3:00 PM I ate 8 cookies and 1/2 of a bananna. I paid for it later.
I drank plenty of water during the ride, along with Gatoraide. I knew I was fine, because I was peeing. When I don't pee, I know I haven't taken enough water/etc. in.
I had a horrible headache later on, and the only way I got it to kind of go away was by eating.
You didn't mention what you eat on a ride. Are you eating enough calories?
"Life is not a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather, to skid in broadside thoroughly used-up, totally worn out, and loudly proclaiming: WOW WHAT A RIDE!!!!"