Yes, it is perfectly okay for domestic cats to eat flies, spiders and bugs of all kinds but see the caveat below. Wasps and bees are a problem because they can get stung. But it is completely natural for domestic cats to consider flies and spiders as prey.
The insatiable curiosity and drive to hunt inevitably leads domestic cats to chase, kill and eat spiders and flies. It looks a bit gross but it’s natural. It should not cause any harm.
The snippet from a chart published in the book Wild Cats of the Words shows that insects are prey items for the ancestor to the domestic cat, the African-Asian wildcat.
In the semi-desert areas of Botswana studies of feces of the North African wildcat show that they often hunt and kill hunting spiders; a very large spider.
Although domestic cats are strict carnivores they are also adaptable and I am sure you have seen them eat bits of cereal and other human foods which are non-typical to their diet.
Some potential dangers
This is about common sense. If insects are killed with an insecticide and a cat subsequently eats the insect the cat will be ingesting poison in a small dose. Also some insects are poisonous. You just have to be alert to these possibilities. You can’t take a blank cheque approach and say all insects are okay as prey for the domestic cat. The vast majority are. One final point is the amount flies and spiders a cat eats. Rarely they may eat too many causing a stomach upset.
However in my experience domestic cats take very few flies and spiders. For a domestic cat it is a trifling passtime to catch and eat a spider. It doesn’t happen that often but it must depend on where you live.