@yake84 I experience neck pain myself, but not headaches. Gwendolene Jull is the expert on neck pain and cerviogenic headaches. Listen to her here. I encourage you to read her scholarly research articles.
Now, I'm going to throw out a topic that is worth thinking about: There is quite a bit of interest in the relationship between co-contraction and neck pain. As you probably know, you have opposing muscles around each joint (agonist and antagonist muscles). Your brain sometimes activates muscles that oppose each other because that can make you more stable. When two opposing muscles act at the same time, it is called co-contraction. Of course, if you want to move your body fast, your brain needs to tone down the antagonist muscle and ramp up the agonist muscle so that you can move easily and smoothly.
If you are experiencing long term pain in your neck, then it almost a certainty that the muscles of your neck are co-contracting more than they should. Your nervous system is bracing (stiffening) your neck for extra stability (protection) because it is fearful that your neck might be weak or vulnerable. The downside of excessive co-contraction is three fold. 1) It fatigues your muscles 2) it makes movement less coordinated and 3) it puts extra pressure on your joints, which in the case of your neck would be your disks. Excessive co-contraction has been measured in the lumbar spine, knee and neck.
When I go to the gym, I see all the guys straining and tightening/stiffening their necks; they are co-contracting hard. You can see the manifestation of this in a prominent sternocleidomastoid (SCM). I don't know if there is any biomechanical advantage to co-contracting your neck while you are doing, for example, biceps curls; It seems to just be an automatic response of your nervous system when you are straining against any load.
If you are getting cerviogenic headaches from going to the gym, it may help to deactivate this automatic neck co-contraction that happens when you strain. So, here is my own personal suggestion. First, become familiar with your SCM. Palpate it and relax it regularly during the day. Observe other people's SCM's at the gym. Now, when you exercise, try to keep your SCM relaxed. If your SCM is relaxed, then I believe you will have less co-contraction in your neck musculature.
Notice, that the SCM is an accessory breathing muscle - meaning that the SCM can help your diaphragm during breathing. If you diligently keep your SCM relaxed, you are going to find that breathing becomes more challenging because you have to do all your breathing with your diaphragm. Nothing wrong with using your diaphragm. It is a good practice to master.
Anyway, I practice SCM relaxation myself at the gym. Not necessarily in every lift, but in many of them. It may not solve your headaches, but I believe you'll find it an interesting discipline. Let me know what you find.