I don’t have any good data to back this up, but for me whenever I start feeling sick I usually do a 40 hour water fast and that typically knocks out the illness.
My personal theory is that it allows the body time to focus on what’s making me sick and not process food, but I’m not a medical professional.
If its viral, eat. If its bacterial fast.
I have plenty of anectdotal evidence to confirm this. I have had relapses after almost recovering from viral infections because I started fasting again too soon, of course this could have happened anyways, but had the same thing happen too many times to believe it was a fluke. From my understanding some parts of the immune system wants glucose to multiply or something like that.
Take my anecdotal “evidence” with a grain of salt, but a lot of google results including some research confirm this. (Also read the sticky note to the right regarding vaccines).
https://news.yale.edu/2016/09/08/listening-body-study-examines-effects-fasting-infections