Abby, That's great that it helps you. Caffeine can increase both dopamine and acetylcholine. For some, that will help. For others, not so much!
Some migraines have been associated with a lack of acetylcholine. There are some fairly recent studies on that in PubMed. I'd get them but I screwed up my back (MG) and can't sit.
Too much MSG, like that which naturally occurs in tomatoes, can give you a headache or make one worse. Some people have trouble with prostaglandins like fish that give them headaches (me included).
Coffee also contains a lot of potassium. Could that be a factor too?
I hope your experience helps others.
Annie