Logistics/Eating

Forget about tactics, armoury .. what I've often wondered about in warfare is the necessity of keeping - as much as is possible - energised & capable soldiers on the front line.
So they had to eat! How were the front line WW1/ WW2 soldiers fed? Is there a general approach to this - no matter what the war?
So they had to eat! How were the front line WW1/ WW2 soldiers fed? Is there a general approach to this - no matter what the war?