We often do not get enough water during the day, and coffee, tea and sodas act as a diuretic further dehydrating the body. This can cause headaches. If you can drink an eight to 16 ounce bottle/glass of water and then go lay down somewhere quiet and close your eyes for a while, headaches for this reason will go away in about 15 min. If you can't do this, or it is a tension headache, closing your eyes and doing some slow breathing can also help. Also try scalp or neck and shoulder massage. You can do it yourself or find a partner to help you and there are examples online that are easy to find. Our scalp and neck muscles can tense up due to stress/posture problems and cause restricted bloodflow which can cause a headache.
If it's migranes you are getting, or the flu coming on, you're probably stuck with medicine. When I get a whopper that won't respond to non-med approaches, Naproxen seems to work for me. But, be sure to take it with food since it can cause upset stomachs in some and is linked to some much more serious complications.
If you get them often, you'll want to see a doctor.
Hope this helps.
J