These are the Rebbe's letters to individuals about their own situations. Throughout, the Rebbe instructed people to consult an expert doctor and follow his guidance; anyone facing a medical question should do the same.
The Rebbe's guidance to people suffering from headaches and migraines:
Consult a specialist and follow his instructions (IK 846, 6812). The Rebbe sometimes suggested asking the doctor specifically about a medication then commonly prescribed for this, nicotinic acid (IK 3201, 5844).
Headaches often come from overthinking and nerves, so work on calming the mind (IK 1615). A headache that comes during study is likely to pass when one learns with joy and together with a chavrusa (IK 5173).
"One who has a headache, let him engage in Torah" (Eruvin 54a). The Rebbe explains how Torah study serves as healing (IK 1269).
For migraines: obtain a small mezuzah that has been checked and is kosher, wrap it in several layers, and carry it (except where carrying is forbidden, such as in a public domain on Shabbos) (IK 3201).