Common ways to help identify dietary food triggers involved in headaches include the following methods.
Food/ symptom diaries: Record what you eat and drink, food brands, when you eat and how much. Software apps (such as for smartphones) can look at trends in your food/ symptom records to figure out (statistically) more likely headache culprits.
Selective elimination diets: You eliminate the most likely dietary culprits for a period of time, typically four weeks. Then, you reintroduce eliminated items, one per day at the most, to see if they trigger headaches (or other symptoms).
Blood tests: Although controversial, some doctors use blood tests (such as those testing for IgG antibodies to foods), to guide which foods are included or removed in elimination diets. More research is needed on such tests.
Note: Never consume a food or beverage if you have a food allergy to it.