Take anti-inflammatories such as cod liver oil, flax seed oil (very recommended), and eat foods such as broccoli and wild salmon. Turmeric and coconut oil help.
Avoid coconut milk/cream as well.
I used to get a lot of headaches after playing video games and having a poor posture. I also put it down as tension headaches. They got better as I developed neck muscles getting older, but came back afte I had to stop going to the gym after surgery, and took too many antibiotics.
What I realised is they aren’t entirely caused by tension, but inflammation due to toxins. Being on the diet and detoxing helps, so try that (sauna, hot + cold showrs, skin brushing, juices and teas like nettle leaf). Also try out yoga, or at least yoga to avoid tension headaches. It’ll strengthen the muscles in your neck. When you do get them, relax and destress. No sudden movements and reduce your heartrate. Relaxation is key, so is meditation. It can be as simple as lying on your bed and relaxing every muscle and clearing your mind. No hokey-BS.