Dropping caffeine does give rotten headaches. The easiest way is to ease off the caffeine..I cut out by a cup at a time over a couple of weeks...rather than go cold turkey.
The headaches will pass if you do the dead stop but it is a painful way to go.