Check your hydration levels you might be dehydrated
I used to get headaches too /: Not nice at all...make sure that you're hydrated :) I found that if I have a glass of 100% fruit juice/water before a workout helps. Also make sure you're not working out on an empty stomach as your sugar levels could get low really quickly and that leads to headaches etc. Don't eat a huge amount though...have a handful of raisens etc.
mabye it can also be a breathing problem , that you get too less air i am not sure though i hoped this helped ;-)
If your getting dehydrated it will also give you bad headaches.
Most likely dehydration and water is the fix. If you are drinking water and still get headaches it could be you're losing electrolytes thru your sweat and not replacing them (esp if you train in heat, endurance train or just sweat a lot). Try a sport drink (good one like nuun, heed by hammer, cytomax etc. i dont mean gatorade / powerade). If you still have them...see your doc. Headaches can be a sign of somethi g serious as well. Best of luck!