There are differing views on what can cause headaches. I submit there are several muscles (most notably the splenius capitis) that can cause pain that feels like a “cap on top of the head”:
The active trigger point (felt as a muscle knot) can be felt where the “x” is. When compressed, it refers (or sends) pain to the region in red. It can be released by holding compression on the “x” for 1-2 minutes until the knot feels dissolved. Then you take the muscle GENTLY through its full range of motion, using a stretch such as this:
(image: Rock Sports & Spine Therapy)
The most common trigger for this used to be called “birdwatching posture,” but NOW it’s called “monitor-watching posture.” This happens when you crane your head forward to peer at your monitor or smartphone.
If you find a chair in which you can lean back 110-120˚ (ideally with a headrest so your neck doesn’t fatigue and strain), this will probably help stop this type of headache from recurring, if it’s of muscular origin.