You need to eat healthy, and cut out junk food as much as possible. Also maintain a proper schedule for food, sleep, and exercise. Exercise is an important aspect of a healthy lifestyle. And if you can feel that the headache is coming on, why not sweat it out and feel it disappear?