It is possible you won't get the headache while fasting, or that the headache you start the fast with will end quickly. I have suffered a lot of migraines in the last ten years of my life which I have mostly just suffered through without medication, though they have laid me low for up to 2-3 days at a time. When I have used medication it has only been the strongest headache medication available by prescription that has helped at all so I've only ever taken them as a last resort so as to not be bedridden for days while needing to look after my kids. Over the last four months since I've been fasting and eating raw foods however I have had no headaches at all though. The headaches were certainly food related and so far it seems related only to the foods I have stopped eating altogether, which isn't surprising since I never ate those foods in such quantities before I started gettingt he migraines.
At worst you may have to bear the pain for a little while without medication knowing it is for the ultimate gain of not having them again after the healing is completed during your fast. Your fear is that you will suffer the headache during the fast at some point, that is quite possible but whether you suffer them or not it is more likely than not that you won't have to endure them again afterwards.