I'd wait to hear from your doctor of course, but it seems likely that dropping t levels would be the problem if it's always around the time your shot is due. I think I was 3 or 4 months in when I had my dose raised, and haven't seen any issues so far since.
as for what to do about headaches, I tend to get them when I'm stressed, and I will either drink water with lemon or something with a bit of caffeine, rest, and take some acetaminophen if I really feel like I need it. dark chocolate and black coffee are also good for headaches in my experience. not sure how bad yours are, but Excedrin migraine has always been my "big gun" of choice.
and just practice general prevention when possible, like avoiding excessive stress and heat, eating right, and staying hydrated, etc :^P