If you suffer from migraines, you probably are well aware that red wine, cheese and chocolate are notorious headache-triggering foods. But did you know that many seemingly benign foods—including citrus fruits, onions and yogurt—also may make your head throb?

Neurologist Alexander Mauskop, MD, director of the New York Headache Center, explained that almost any food can trigger a migraine in certain individuals, though what sets off a headache in one person may not affect another at all. Figuring out which foods to avoid can be an exercise in frustration. Reasons: You may react to a single bite (for instance, just one almond)… or you may get a headache only when you eat at least a full serving of that food. Also, a certain food may set off a cascade of pain every time… or you may react to that food only when some other factor comes into play — for instance, when you’re sleep-deprived or stressed.

To identify your problem foods, Dr. Mauskop recommended keeping a food diary and looking for patterns. Simplest: Make a list of everything that you consumed in the eight hours before a migraine began. More revealing: Keep a daily journal that tracks what and when you eat… exercise and sleep patterns… stress levels… menstrual cycle… weather… and anything else that you suspect might be linked to your migraines. Continue for two to three months if you typically get six or more headaches per month. For less frequent headaches, you may need to keep the journal longer to detect patterns. High-tech help: Download the free app Headache Relief Diary (for iPhone, iPad or iPod Touch), developed by Dr. Mauskop, through the iTunes store.

Researchers do not know the exact mechanism behind all dietary migraine triggers. But foods containing naturally occurring substances called amines, which dilate blood vessels, often play a part — because for migraine-prone people, even tiny changes in blood vessel dilation can induce a headache. Particularly suspect are tyramine, phenylethylamine and histamine. Certain categories of amine-containing foods cause problems for many migraine sufferers. Here are some of the most common culprits…

Nuts. Though Dr. Mauskop often prescribes magnesium supplements as a preventive measure for migraine patients (and nuts are chock-full of this mineral), he nonetheless cautions against nuts and nut butters because they can trigger headaches — perhaps due to their tyramine content. Almonds and peanuts are particularly problematic. Your food diary can help you determine which nuts, if any, are safe for you.

Fruits and fruit juices. The most likely offenders are citrus fruits, such as grapefruits, lemons, limes, oranges and tangerines… and tropical fruits, including avocados, mangoes, papayas, passion fruits and pineapples. These all contain tyramine and phenylethylamine… citrus fruits also release histamine.

Dried fruits. Raisins, prunes and dried apricots (as well as red wine) all contain amines. Additional problem: Dried fruits also contain sulfites, a type of preservative known to provoke headaches in some people. Even organic versions of these foods can trigger headaches, Dr. Mauskop cautioned, because some sulfites occur naturally.

Vegetables. Onions, snow peas and certain beans (broad, fava, lima) all contain tyramine.

Fermented, aged or overripe foods. Fermented foods, such as yogurt, beer and breads made with yeast, contain histamine. Also, tyramine levels rise when food is aged (as with certain cheeses) or no longer fresh (which is why an overripe banana or avocado, for instance, can set off a migraine).

Coffee and tea. These do have amines — but that is only part of the problem. The other factor to consider is caffeine. Dr. Mauskop explained that many nonprescription and prescription headache medicines contain caffeine… and when used no more than twice weekly, caffeine often can relieve headaches. But: For some people, caffeine — especially when consumed daily — actually can make migraines more frequent, severe and difficult to treat.

Whatever foods you end up needing to avoid, one thing to get plenty of is water. Dr. Mauskop said, “Dehydration is a known migraine inducer, so patients often get better when they drink more fluids. We call this the water cure.”