Purpose: It remains unclear whether primary headaches, particularly migraine, are associated with glaucoma. We investigated potential associations between primary headaches, including migraine and tension-type headache (TTH), and primary glaucoma, including open-angle glaucoma (OAG) and closed-angle glaucoma (CAG).Methods: We used data from the Clinical Data Warehouse collected between 2008 and 2023 to investigate whether migraine and TTH influence the risk of primary glaucoma. We compared the prevalence of primary glaucoma, including OAG, CAG, other glaucoma, and total glaucoma (TG), among patients with migraine, those with TTH, and controls.Results: This study analyzed 46,904 patients with migraine, 48,116 patients with TTH, and 455,172 controls. Controls were selected based on propensity score matching (PSM). After adjustment for covariates and PSM, the fully adjusted odds ratios (ORs) for patients with migraine were 1.83 for OAG (95% confidence interval [95% CI], 1.33–2.51; p<0.004) and 1.55 for TG (95% CI, 1.26–1.91; p<0.004) compared to controls. Furthermore, in patients with TTH, the ORs for CAG were 2.20 (95% CI, 1.40–3.47; p<0.004) compared to controls. Additionally, patients with migraine had fully adjusted ORs of 1.71 for OAG (95% CI, 1.24–2.36; p<0.004) and 1.41 for TG (95% CI, 1.15–1.73; p<0.004) compared to those with TTH.Conclusion: Migraine is associated with primary glaucoma, particularly OAG.