It may be a case of lowered blood pressure after a sleep. I have it this way myself.
Coffee of course may help to fix it, but coffee itself is not a good thing.
I learned to fight my after-sleep low BP by doing some low-to-mid intensity exercise, typically jogging for 3-5 km. Listening "Bootstrapped" podcast at the same time. Usually the headache is gone in 10 minutes.