Not constipation, but gut problems for sure and veggies and fibre help for sure…
Migraine
Community for support, conversation, and healing among migraine sufferers.
Maybe have a bit of a look at the Gut-Brain Axis research. There’s a strong link between the brain and your gut micro biome. If you can improve the bacteria in your gut, you may prevent constipation and reduce your migraines.
I don't suffer from actual migraines, but I experience a VERY strong correlation like yours. To the point where, if I have anything but the mildest headache I run first for vegetables and such and second for Tylenol.
Anything is possible. I deal with both but never saw a correlation. The most likely thing could be dehydration which definitely cause migraines for me and also have an impact constipation.
As to constipation, of course try the usual things recommended. What seems to be helping me of late is eating plenty of kimchi which has lots of probiotics and also taking Jarrow Ideal Bowel Support.