Interestingly there is increasing evidence that coffee (and tea) may confer certain health benefits, so where does this leave the migraine sufferer?
Earlier this year, the American Dietary Guidelines Advisory Committee released a report stating that up to five cups of coffee per day, or up to 400 mg of caffeine, is not associated with long-term health risks. Not only that, they highlighted observational evidence that coffee consumption is associated with reduced risk for several diseases, including type 2 diabetes, cardiovascular disease (CVD), and neurodegenerative disorders. The data suggesting that moderate coffee (and, in all likelihood, tea) consumption is not only safe but beneficial in a variety of mental and medical conditions is growing.
For instance, Caffeine consumption can cause a short-lived increase in blood pressure, and regular use has been linked to a longer-term increase. However, it seems when caffeine is ingested via coffee, enduring blood pressure elevations are small and cardiovascular risks may be balanced by protective properties. Coffee beans contain antioxidant compounds that reduce oxidation of low-density lipoprotein (LDL) cholesterol, and coffee consumption has been associated with reduced concentrations of inflammatory markers.[4-9] Moderate coffee intake is associated with a lower risk for coronary heart disease (data).
A meta-analysis presented at the 2012 European Meeting on Hypertension and Cardiovascular Protection found that one to three cups per day may actually protect against ischemic stroke in the general population.
Studies have also linked regular coffee drinking with improved glucose metabolism, insulin secretion, and a significantly reduced risk for diabetes.[16-19] Most recently, findings from a long-term study published this year suggest that coffee drinkers are roughly half as likely to develop type 2 diabetes as are nonconsumers, even after accounting for smoking, high blood pressure, and family history of diabetes.
Furthermore a 2012 study suggested coffee may slow the progression of dementia & Parkinson’s & a 2011 study concluded that a boost in coffee consumption might also benefit our mental health in other ways such as providing some protection against depression.
Other studies have suggested many other possible benefits; for example on the liver, or by helping with symptoms of gout…..
Firstly it’s important to note that much of the evidence on the potential health effects of coffee/caffeine, is associational and doesn’t prove causality—observational investigations come with limitations and often rely on error-prone methods such as patient questionnaires : Correlation DOES NOT necessarily mean causation!
Secondly there are also risks, and coffee consumption certainly has negative medical and psychiatric effects to consider. Besides the obvious as a trigger for headaches/migraines coffee has the potential to increase in blood pressure, can incite or worsen anxiety, insomnia, and tremor and potentially elevate glaucoma risk 
Perhaps one of the most common triggers I encounter for headache & migraine is caffeine. This is present it many foodstuffs & I have discussed it at length in a previous article Caffeine as a trigger to migraine/headaches? ,
So the first thing to do is decide if caffeine is trigger for your own personal headache or migraine.
Clues that caffeine may be playing a role are that your headaches occur in the evening or upon awakening, when it has been the longest since your last dose of caffeine. Weekend headaches, when people may sleep in and delay their caffeine drinking, may also be a caffeine-withdrawal pattern. Also, if taking caffeine treats the headache, you are likely managing the caffeine withdrawal!
It takes at least two weeks for the caffeine withdrawal symptoms to go away ( sometimes longer). I generally like to give my patients a caffeine-free trial for two to three months at least to see what their baseline headaches/migraines are like without caffeine.
It is also worth noting that whilst caffeine may not directly trigger your headache it may contribute to either insomnia or anxiety that may in turn play an important part in predisposing you to your headache/migraines.
SO IN CONCLUSION…
If you are SURE caffeine is not playing a part in your headache or contributing to it via insomnia or anxiety, then it seems a few cups of coffee and/or tea may well be good for you !