Take a drug holiday!
And no, we are not talking about a weekend away in Amsterdam!
Medication and head pain can be associated in various ways the two most common are;
1) Headache as a side-effect of a medication (which is being taken for an unrelated medical condition.)
The obvious clue would be if your headaches began at the same time (or soon after) starting to take some form of medication. If this is the case, firstly check if headache is listed as a side-effect of that particular medication. If it is then it is worth discussing with your doctor/specialist if there is an alternative.(It should be noted that some side effects of medications may wear off after a week or two of taking them, so if the headache is not too bad you may wish to persevere for short while before visiting your GP)
If headache is not listed as a side-effect, but you still feel that there may be a link, then once again you could ask your GP for an alternative or possibly suggest stopping the medication for a few weeks to see if the headaches disappear, then restart the medication and see if the headaches reappear.
2) Medication Overuse Headache (aka rebound headache). This is a common problem among patients with chronic headache and/or migraine. Research has shown that all forms of painkillers which are commonly taken for headache and migraine, can, if taken too often, actually make headaches/migraines worse! This includes opioids/codeine-based painkillers ( of which there are many; check label or online), non-steroidal anti-inflammatories ( neurofen/ibuprofen/naproxen etc), triptans ( imigran, zomig, sumatriptan etc ) and even asprin & paracetamol.
The question is how often is too often! This probably varies from person to person, but current consensus is that if you have been taking a full dose of codeine-based painkillers more than 10x per month, or non-steroidal anti-inflammatories/triptans more than 15x a month, for more than three months, then there is a distinct possibility that you may have medication overuse headache.
(Some studies even suggest taking painkillers as little as twice a week may lead to increased headache frequency in certain individuals.)
So if you have been taking frequent painkillers for your head pain a `drug-free holiday`, ideally for a minimum of three months, should be seriously considered. However you should be aware that in the short-term the headaches/migraines are likely to significantly worsen before they start to improve.
It is also important to stress that if you have been taking frequent painkillers for more than a few months giving them up can be extremely difficult and you will almost certainly need to seek the advice and help of your GP/headache specialist to manage your `detox`.