If they think about it at all, people will commonly claim wine headaches come from sulfites. This is almost certainly wrong, and it’s been wrong so confidently and for so long that it’s become received wisdom. (Dehydration is implicated too, but I think that’s not the main case unless you go on an actual bender.)
Sulfites are a preservative added to most wine, and they sound like the kind of thing that would cause headaches. The problem with the sulfite theory is empirical: dried apricots contain roughly ten times the sulfite concentration of most red wine, and nobody reports apricot headaches. People with genuine sulfite sensitivity - a real condition, primarily affecting asthmatics — experience respiratory symptoms, not headaches. If sulfites caused wine headaches, white wine (which has higher sulfite content than red) would cause more headaches than red. It doesn’t. The pattern is exactly backwards.

The actual candidates
Histamines. Red wine contains histamines. People vary significantly in their ability to break down histamines due to differences in diamine oxidase (DAO) enzyme activity. Low DAO = trouble with histamine-containing foods: aged cheese, cured meats, fermented things, red wine. The headache shows up hours later, often the next morning. Sound familiar?
Tannins. Red wine is high in tannins. Tannins affect serotonin in some people. Serotonin fluctuations are associated with headaches. If you get red wine headaches but not white wine headaches, and if you also get headaches from strong tea or dark chocolate, tannins are a plausible culprit.
Tyramine. Another biogenic amine, same mechanism problem as histamines. Aged and fermented foods are high in tyramine. Tyramine triggers the release of norepinephrine, which can cause blood vessel changes associated with headaches. Also implicated in migraine triggers more generally.
Dehydration. Alcohol is a diuretic. If you drink wine with dinner and minimal water, and you’re slightly dehydrated to begin with, the next-morning headache is mostly just dehydration. This is obvious and boring but probably accounts for more wine headaches than any of the interesting chemistry.
Congeners. These are byproducts of fermentation — chemical cousins of ethanol that are produced in smaller quantities. Darker spirits (bourbon, brandy) and red wine have more congeners than clear spirits and white wine. There’s some evidence congeners contribute to hangover severity, though the mechanism isn’t fully established.
My Pet Theory
The main thing I have observed is that entire countries are generally safe for me. French and Italian are obvious to me. There are rules for winemakers to follow there that California wines, as the most eggregious example, do not. In particular the ferment temperatures and durations are different. This leads me to believe I’m strongly affected by congeners.
What you can actually do
If you suspect histamines: try taking a DAO supplement before drinking. Available at health food stores, reasonably cheap, no harm in trying. Alternatively, stick to wines that are lower in histamines — generally white wines, lighter-style reds, wines from cooler climates.
If you suspect tannins: the experiment is easy. Do you get headaches from tea or dark chocolate? Try low-tannin reds (Pinot Noir, Gamay) instead of high-tannin ones (Cabernet Sauvignon, Nebbiolo, Syrah). Do you feel better? There’s your answer.
If you suspect dehydration: drink water. This is embarrassingly simple advice but it works. A glass of water per glass of wine, or at minimum a large glass before bed.
If you suspect it’s just the sulfites: try some dried apricots and get back to me.
The bottom line for me
Over the years I’ve noted there are wines that don’t agree with me, and wines that are fine.
This was driven home to me in a comical way one night when I was part of a group of four that drank Veuve for about six hours. AND I had to get up early the next morning. I was surprisingly fine. Certainly no headache. And that’s when I realized this was something that deserved some actual thought. Photo above another one of the results.
Keep track of how you feel after different wines. If that bottle of Josh makes you feel crappy, don’t waste your body on it!
I don’t have a clean conclusion here because the reality is that wine headaches are probably caused by different things in different people, and the human body’s chemical responses to fermented grape juice are genuinely complicated. What I do know is that the sulfite story is likely wrong, and accepting a wrong explanation makes it harder to find the right one.
The right approach is to treat yourself as an experiment. Vary one thing at a time. Keep notes. Eventually you’ll know more about your own chemistry than anyone else does, which is a more useful piece of information than whatever the internet told you about sulfites.