If the headaches are extreme or do not go away, seek medical advice.
Use painkillers such as Aspirin and Paracetamol as directed.
Get plenty of sleep and rest.
Consider switching coffee for teas that contain significantly less caffeine. Herbal teas that are caffeine free would be even better.
Ensure you are drinking enough water.
Eat good food with plenty of nutrients.