my best suggestion is to stop drimking beer.But if you you cnt stop then just buy some headache meds everytime you get ready to drink beer.
Which meds are you taking?
I don't drink alcohol at all, but I know that one of the first reactions you can have is a headache from brain dehydration. Try drinking a glass of water or two, before the beer and see if it makes any difference. Us older types start to become deficient in enzymes after 40, including Taurine, which, among other benefits, helps protect the brain from dehydration. A trial of Taurine supplementation might help.
Yeast can effect the brain by causing headaches too. So it could be something in the way the beer was manufactured.
Good luck!