Based upon your explanation the actual cause in not clear. Although the usual causes are lack of fiberous diet, excess junk foods, lack of physical activity, drinking less water, disturbance in digestion due to seasonal changes etc. And as far as headache & gas in stomach is concerned, it is the complication of constipation. Following medications and health tips can be helpful. For details consult an ayurvedic physician.
Next Steps
Take Tab. Anuloma DS with warm water at bedtime.
or
Take Gandharvahastadi Kashaya --40ml with hit water at bedtime
Health Tips
1. Increase fiber in the diet
2. do not suppress the urge of defecation
3. do exercise
4. drink plenty amount of water
5. avoid junk foods
6. do Pranayam & Yoga