The answer is often as individual as the person, but a study by scientists in Italy, where foodie-ness is next to Godliness, find that both migraines and tension headaches can be triggered by alcohol, cheese and chocolate.
Strangely, a specific food may not act the same way in the same person, one time after another. And the headache may not appear for 24 or even 48 hours.
The top causes in the U.S. are
*coffee and tea, because of their caffeine;
*monosodium glutamate (i.e., “natural flavorings” in condiments); *milk and dark chocolate (more likely the theobromine and phenylethylamine than the caffeine);
*aged, tyramine-rich cheeses, like blues, and aged cheddar; *fermented dairy products, like yogurt and sour cream;
*nuts and nut butters, also for the tyramine;
*wine, liqueurs and liquors, because of their (anti-bacterial) sulfite concentration, and because of their cogeners, or impurities, which may also give extra flavor—vodka and white wine have less;
*yeasty, fermented dough baked breads, bagels, doughnuts; and *processed meats, preserved with nitrities and nitrates.
Trial and error are the only way to know for sure. But this list is a good start.