Most often, wine, especially reds, get blamed for a headache. Some people experience a headache even after drinking small quantities of red wine but there's no scientific evidence that pinpoints a link between headaches and red wine.
Sulfites, tannins, histamine, and tyramine levels in wine have been cited as probable causes for wine headaches. But consider this: higher amounts of sulfites are present in fruits (and dried fruits), chips, pickles, soy sauce, soda, and cured meats; higher doses of tannins are also in tea, dark chocolate, some berries, and nuts. Histamine and tyramine can be found in other alcoholic beverages; more in fermented foods (tofu, sauerkraut), aged cheeses and packaged/processed foods, legumes, etcetera.
If you are not sensitive to these foods, it is less likely that the wine alone will trigger a headache.
It would rather be a good idea to:
Avoid drinking wine on an empty stomach
Have healthy sleeping habits
And if these practices do not give relief, then make a note of the grape varieties, styles, or brands that trigger your headache and avoid them in the future. Or, switch to lighter red wines.