There's a clear and simple explanation here:
Https://www.sciencedaily.com/releases/2022/02/220203083601.htm
Or here:
Https://mineralsformigraines.com/avoid-spicy-food-if-you-get-migraines/
Or here: https://www.futurity.org/migraine-pain-schwann-cells-2692282-2/
I've had no chilli or cayenne for 2 weeks, and though it's too early to be sure (migraine is unpredictable. I do occasionally, though rarely, have 2 weeks without an attack) so far so good.