At age 17, I had a trip to the ER thinking I was dying -- worst headache of my life up to that point. It subsided during my stay and several tests later, any major problems were ruled out. I was not a regular caffeine drinker at that time, and caffeine has never caused Migraine headaches[0] for me. Over a few years of early mornings/jobs, I started drinking coffee regularly to be sharp/awake and experienced many of the same problems as the author. The biggest problem, though, was that I had become tolerant to the most effective medication (for me) to eliminate my headaches.
I would not advise quitting cold turkey. It sucks. The headaches are intense, but not Migraine[0]. After doing that for a few days, I took a different approach -- to replace my coffee consumption with decaffeinated coffee. At the time (I'm not sure if this is still true), decaffeinated did not mean caffeine free. It had just enough to ween me off of caffeine, while keeping my routine the same for a month. The dull headaches were manageable with a single Ibuprofen when they were the worst, but often required nothing at all. At the end of a month, the beans sat unused.
I treated caffeine as a medication from that point forward. I kept a container of beans in the freezer and would brew up a cup of coffee any time Migraine reared its ugly head. It took about a cup and my symptoms would be reduced -- sometimes remaining there until the headache passed. I've since found a prescription which prevents Migraine entirely, for me and have resumed coffee drinking, but limit it to a single cup a day and not daily -- just when I'm feeling "dull", mentally. But I have to be careful -- the jitters are very strong after the second cup and end up turning that sharpness into anxiety at times.
[0] I think people misstate a "bad headache" as a Migraine headache. I get different kinds of headaches, Migraine is very distinct to me, including auras and other symptoms that otherwise awful headaches do not. They also barely respond to common OTC medications, so I don't bother with them when I know it's a migraine.