Like sibling posts say, inflamed gut leaks histamine, inflames it more and leaks more. Try low histamine and in general low processed and spicy food diet for a while to reset this feedback cycle. Good start: https://www.mastzellaktivierung.info/downloads/foodlist/21_F...
I tried a low histamine diet for a few months. Including DAO enzymes and histamine lowering probiotics. Didn't seem to make a difference for me. Eventually I found out that spicy food actually helps me a lot: it's anti-inflammatory and prokinetic.
After 6 months of testing different diets to try to solve my migraines, I eventually discovered an ultra-low histamine diet resulted in a ~90% decrease in my headaches. Then I began trying different DAO products before eating foods with histamine, but the headaches returned. I eventually discovered NaturDAO (available via Amazon) and its much higher 1,000,000 HDU per pill. Taking two of these before any meal or coffee finally worked to stop the food-induced migraines for me. Hope this helps.